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:
Olaoluwa Osuntokun committed 2018-01-22 19:19:45 -08:00
1 parent d0f8b5f194
commit fc8a6568c9
2 files changed
+45 -10

No files matched your search

+7 -3
View File
@@ -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)
}