This commit is contained in:
Thomas E Lackey 2022-10-07 15:42:54 -05:00
parent c0736668c1
commit 7e45413e3d

View File

@ -39,16 +39,7 @@ var _ = Describe("e2emerge", Label("e2e"), func() {
log.Debugf("Sent ETH1 TX %s (Block No: %d, Block Hash: %s)", log.Debugf("Sent ETH1 TX %s (Block No: %d, Block Hash: %s)",
tx.hash, tx.blockNo, tx.blockHash) tx.hash, tx.blockNo, tx.blockHash)
var beaconBlock *beaconclient.DbSignedBeaconBlock beaconBlock := waitForTxToBeIndexed(bc.Db, tx)
for i := 0; i < 30; i++ {
time.Sleep(time.Second)
record := checkForTx(bc.Db, tx)
if nil != record {
beaconBlock = record
log.Debugf("Found ETH1 TX %s in SignedBeaconBlock %d/%s", tx.hash, beaconBlock.Slot, beaconBlock.BlockRoot)
break
}
}
Expect(beaconBlock).ToNot(BeNil()) Expect(beaconBlock).ToNot(BeNil())
}) })
}) })
@ -67,7 +58,21 @@ func (tx *SentTx) RawHex() string {
return "0x" + hex.EncodeToString(tx.raw) return "0x" + hex.EncodeToString(tx.raw)
} }
func checkForTx(db sql.Database, tx *SentTx) *beaconclient.DbSignedBeaconBlock { func waitForTxToBeIndexed(db sql.Database, tx *SentTx) *beaconclient.DbSignedBeaconBlock {
var beaconBlock *beaconclient.DbSignedBeaconBlock = nil
for i := 0; i < 30; i++ {
time.Sleep(time.Second)
record := lookForTxInDb(db, tx)
if nil != record {
beaconBlock = record
log.Debugf("Found ETH1 TX %s in SignedBeaconBlock %d/%s", tx.hash, beaconBlock.Slot, beaconBlock.BlockRoot)
break
}
}
return beaconBlock
}
func lookForTxInDb(db sql.Database, tx *SentTx) *beaconclient.DbSignedBeaconBlock {
sqlStatement := `SELECT * FROM eth_beacon.signed_block WHERE sqlStatement := `SELECT * FROM eth_beacon.signed_block WHERE
payload_block_number = $1 AND payload_block_number = $1 AND
payload_block_hash = $2 AND payload_block_hash = $2 AND