nursery_store: detect Late Registrations when promoting to kindergarten
In this commit, we aim to address a lingering bug caused by a Late Registration of a kid output from preschool to kindergarten. In this scenario, an output is promoted, but *after* it’s target maturity period, meaning that we won’t graduate the output until we restart. To avoid this, we’ll now detect this case, and bump the graduation height by one to ensure that when the new block arrives, we properly handle the output.
This commit is contained in:
2 files changed
+45
-10
No files matched your search
@@ -127,7 +127,11 @@ func TestNurseryStoreIncubate(t *testing.T) {
|
||||
|
||||
// Begin incubating all of the outputs provided in this test
|
||||
// vector.
|
||||
err = ns.Incubate(test.commOutput, test.htlcOutputs)
|
||||
var kids []kidOutput
|
||||
if test.commOutput != nil {
|
||||
kids = append(kids, *test.commOutput)
|
||||
}
|
||||
err = ns.Incubate(kids, test.htlcOutputs)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to incubate outputs"+
|
||||
"on test #%d: %v", i, err)
|
||||
@@ -362,7 +366,7 @@ func TestNurseryStoreFinalize(t *testing.T) {
|
||||
|
||||
// Begin incubating the commitment output, which will be placed in the
|
||||
// preschool bucket.
|
||||
err = ns.Incubate(kid, nil)
|
||||
err = ns.Incubate([]kidOutput{*kid}, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to incubate commitment output: %v", err)
|
||||
}
|
||||
@@ -449,7 +453,7 @@ func TestNurseryStoreGraduate(t *testing.T) {
|
||||
|
||||
// First, add a commitment output to the nursery store, which is
|
||||
// initially inserted in the preschool bucket.
|
||||
err = ns.Incubate(kid, nil)
|
||||
err = ns.Incubate([]kidOutput{*kid}, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to incubate commitment output: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user