mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
sync wait
This commit is contained in:
parent
401f747997
commit
177750f1e7
1 changed files with 9 additions and 0 deletions
|
|
@ -1040,6 +1040,10 @@ func (c *Posv) GetMasternodesFromCheckpointHeader(preCheckpointHeader *types.Hea
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Posv) cacheData(txs []*types.Transaction, receipts []*types.Receipt) error {
|
func (c *Posv) cacheData(txs []*types.Transaction, receipts []*types.Receipt) error {
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
|
wg.Add(len(txs))
|
||||||
|
|
||||||
for _, tx := range txs {
|
for _, tx := range txs {
|
||||||
go func(tx *types.Transaction) error {
|
go func(tx *types.Transaction) error {
|
||||||
if tx.IsSigningTransaction() {
|
if tx.IsSigningTransaction() {
|
||||||
|
|
@ -1050,12 +1054,14 @@ func (c *Posv) cacheData(txs []*types.Transaction, receipts []*types.Receipt) er
|
||||||
for _, r := range receipts {
|
for _, r := range receipts {
|
||||||
if r.TxHash == tx.Hash() {
|
if r.TxHash == tx.Hash() {
|
||||||
b = r.Status
|
b = r.Status
|
||||||
|
wg.Done()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if b == types.ReceiptStatusFailed {
|
if b == types.ReceiptStatusFailed {
|
||||||
fmt.Println("Tx receipt status false", tx.Hash().Hex())
|
fmt.Println("Tx receipt status false", tx.Hash().Hex())
|
||||||
|
wg.Done()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1079,9 +1085,12 @@ func (c *Posv) cacheData(txs []*types.Transaction, receipts []*types.Receipt) er
|
||||||
c.Votes.Remove(vote)
|
c.Votes.Remove(vote)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wg.Done()
|
||||||
return nil
|
return nil
|
||||||
}(tx)
|
}(tx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue