mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 03:51:20 +00:00
805230ba63
- Added listening methods for WebSocket subscriptions - Listened for new blocks using the newHeads method to determine when to look for a transaction - Added new util methods and tests for them - Simplified communication to the user upon initiating the devnet tool
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/ledgerwatch/erigon/cmd/devnet/models"
|
|
)
|
|
|
|
// ExecuteAllMethods runs all the simulation tests for erigon devnet
|
|
func ExecuteAllMethods() {
|
|
// test connection to JSON RPC
|
|
fmt.Printf("\nPINGING JSON RPC...\n")
|
|
if err := pingErigonRpc(); err != nil {
|
|
return
|
|
}
|
|
fmt.Println()
|
|
|
|
// get balance of the receiver's account
|
|
callGetBalance(addr, models.Latest, 0)
|
|
fmt.Println()
|
|
|
|
// confirm that the txpool is empty
|
|
fmt.Println("CONFIRMING TXPOOL IS EMPTY BEFORE SENDING TRANSACTION...")
|
|
checkTxPoolContent(0, 0)
|
|
fmt.Println()
|
|
|
|
// send a token from the dev address to the recipient address
|
|
hash, err := callSendTx(sendValue, recipientAddress, models.DevAddress)
|
|
if err != nil {
|
|
fmt.Printf("callSendTx error: %v\n", err)
|
|
return
|
|
}
|
|
fmt.Println()
|
|
|
|
// confirm that the txpool has this transaction in the pending queue
|
|
fmt.Println("CONFIRMING TXPOOL HAS THE LATEST TRANSACTION...")
|
|
checkTxPoolContent(1, 0)
|
|
fmt.Println()
|
|
|
|
// look for the transaction hash in the newly mined block
|
|
fmt.Println("LOOKING FOR TRANSACTION IN THE LATEST BLOCK...")
|
|
callSubscribeToNewHeads(*hash)
|
|
fmt.Println()
|
|
|
|
// confirm that the transaction has been moved from the pending queue and the txpool is empty once again
|
|
fmt.Println("CONFIRMING TXPOOL IS EMPTY ONCE AGAIN...")
|
|
checkTxPoolContent(0, 0)
|
|
}
|