Skip to content

Commit

Permalink
added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaytonNorthey92 committed Mar 11, 2024
1 parent 17ad420 commit 4927945
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions service/popm/popm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,30 @@ func TestProcessReceivedInAscOrderOverride(t *testing.T) {
}
}

func TestProcesAllKeystonesIfAble(t *testing.T) {
miner, err := NewMiner(&Config{
BTCPrivateKey: "ebaaedce6af48a03bbfd25e8cd0364140ebaaedce6af48a03bbfd25e8cd03641",
BTCChainName: "testnet3",
})
if err != nil {
t.Fatal(err)
}

for i := uint32(1); i < 1000; i++ {
keystone := hemi.L2Keystone{
L2BlockNumber: i,
EPHash: []byte{byte(i)},
}
miner.processReceivedKeystones(context.Background(), []hemi.L2Keystone{keystone})
for _, c := range miner.l2KeystonesForProcessing() {
diff := deep.Equal(c, keystone)
if len(diff) != 0 {
t.Fatalf("unexpected diff: %s", diff)
}
}
}
}

// TestProcessReceivedInAscOrderNoInsertIfTooOld ensures that if the queue
// is full, and we try to insert a keystone that is older than every other
// keystone, we don't insert it
Expand Down

0 comments on commit 4927945

Please sign in to comment.