Skip to content

Commit

Permalink
re-added test
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaytonNorthey92 committed Aug 23, 2024
1 parent c17ef6d commit 3a1a1f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion database/bfgd/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 17 additions & 15 deletions e2e/e2e_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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[:])
}
}

Expand Down

0 comments on commit 3a1a1f0

Please sign in to comment.