aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/counter/main.go13
-rw-r--r--examples/payments/main.go5
2 files changed, 6 insertions, 12 deletions
diff --git a/examples/counter/main.go b/examples/counter/main.go
index 5ec83fc..e802a33 100644
--- a/examples/counter/main.go
+++ b/examples/counter/main.go
@@ -141,14 +141,11 @@ func main() {
header.Extra = append(header.Extra, hid...)
})
chain.SetOnSealFinish(func(block *types.Block) error {
- go func() {
- // generate 15 blocks
- blockCount++
- if postGen(block) {
- return
- }
- chain.GenBlock()
- }()
+ blockCount++
+ if postGen(block) {
+ return nil
+ }
+ chain.GenBlock()
return nil
})
diff --git a/examples/payments/main.go b/examples/payments/main.go
index 5a56028..1eab70b 100644
--- a/examples/payments/main.go
+++ b/examples/payments/main.go
@@ -84,9 +84,7 @@ func main() {
})
newBlockChan := make(chan *types.Block)
chain.SetOnSealFinish(func(block *types.Block) error {
- go func() {
- newBlockChan <- block
- }()
+ newBlockChan <- block
return nil
})
@@ -96,7 +94,6 @@ func main() {
tx := types.NewTransaction(nonce, bob.Address, value, uint64(gasLimit), gasPrice, nil)
signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainID), genKey.PrivateKey)
checkError(err)
- _ = signedTx
chain.AddRemoteTxs([]*types.Transaction{signedTx})
nonce++
chain.GenBlock()