From 3a1a1f05ad7e6bdf051ad69a32999c9411ad20bc Mon Sep 17 00:00:00 2001 From: ClaytonNorthey92 Date: Fri, 23 Aug 2024 14:22:07 -0400 Subject: [PATCH] re-added test --- database/bfgd/postgres/postgres.go | 2 +- e2e/e2e_ext_test.go | 32 ++++++++++++++++-------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/database/bfgd/postgres/postgres.go b/database/bfgd/postgres/postgres.go index 544a111e8..6019c0711 100644 --- a/database/bfgd/postgres/postgres.go +++ b/database/bfgd/postgres/postgres.go @@ -1084,7 +1084,7 @@ func (p *pgdb) BtcTransactionBroadcastRequestGetNext(ctx context.Context) ([]byt ) AND broadcast_at IS NULL AND created_at > NOW() - INTERVAL '2 hours' - ORDER BY created_at DESC + ORDER BY created_at ASC LIMIT 1 ) RETURNING serialized_tx diff --git a/e2e/e2e_ext_test.go b/e2e/e2e_ext_test.go index a405be4ff..348b9f98b 100644 --- a/e2e/e2e_ext_test.go +++ b/e2e/e2e_ext_test.go @@ -1437,7 +1437,6 @@ func TestBitcoinUTXOs(t *testing.T) { // 2. call BitcoinBroadcast RPC on BFG // 3. ensure that a pop_basis was inserted with the expected values func TestBitcoinBroadcast(t *testing.T) { - t.Skip() db, pgUri, sdb, cleanup := createTestDB(context.Background(), t) defer func() { db.Close() @@ -1539,21 +1538,24 @@ func TestBitcoinBroadcast(t *testing.T) { t.Logf("test hash is %s", hex.EncodeToString(btcTxId[:])) - diff := deep.Equal(popBases, []bfgd.PopBasis{ - { - L2KeystoneAbrevHash: hemi.L2KeystoneAbbreviate(l2Keystone).Hash(), - PopMinerPublicKey: publicKeyUncompressed, - BtcRawTx: btx, - BtcTxId: btcTxId[:], - BtcMerklePath: nil, - BtcHeaderHash: nil, - PopTxId: nil, - BtcTxIndex: nil, - }, - }) + if len(popBases) != 1 { + t.Fatalf("unexpected length %d", len(popBases)) + } - if len(diff) > 0 { - t.Fatalf("unexpected diff: %s", diff) + if !slices.Equal(popBases[0].L2KeystoneAbrevHash, hemi.L2KeystoneAbbreviate(l2Keystone).Hash()) { + t.Fatalf("%v != %v", popBases[0].L2KeystoneAbrevHash, hemi.L2KeystoneAbbreviate(l2Keystone).Hash()) + } + + if !slices.Equal(popBases[0].PopMinerPublicKey, publicKeyUncompressed) { + t.Fatalf("%v != %v", popBases[0].PopMinerPublicKey, publicKeyUncompressed) + } + + if !slices.Equal(popBases[0].BtcRawTx, btx) { + t.Fatalf("%v != %v", popBases[0].BtcRawTx, btx) + } + + if !slices.Equal(popBases[0].BtcTxId, btcTxId[:]) { + t.Fatalf("%v != %v", popBases[0].BtcTxId, btcTxId[:]) } }