multi: add resolver reports to Checkpoint

To allow us to write the outcome of our resolver to disk, we add
optional resolver reports to the CheckPoint function. Variadic params
are used because some checkpoints may have no reports (when the resolver
is not yet complete) and some may have two (in the case of a two stage
resolution).
This commit is contained in:
carla committed 2020-07-07 19:49:51 +02:00
1 parent 8c8f857f60
commit fa46db9c48
10 files changed
+64 -23

No files matched your search

+10 -6
View File
@@ -338,8 +338,10 @@ func TestContractInsertionRetrieval(t *testing.T) {
resolverMap[string(resolvers[3].ResolverKey())] = resolvers[3]
resolverMap[string(resolvers[4].ResolverKey())] = resolvers[4]
// Now, we'll insert the resolver into the log.
if err := testLog.InsertUnresolvedContracts(resolvers...); err != nil {
// Now, we'll insert the resolver into the log, we do not need to apply
// any closures, so we will pass in nil.
err = testLog.InsertUnresolvedContracts(nil, resolvers...)
if err != nil {
t.Fatalf("unable to insert resolvers: %v", err)
}
@@ -419,8 +421,9 @@ func TestContractResolution(t *testing.T) {
}
// First, we'll insert the resolver into the database and ensure that
// we get the same resolver out the other side.
err = testLog.InsertUnresolvedContracts(timeoutResolver)
// we get the same resolver out the other side. We do not need to apply
// any closures.
err = testLog.InsertUnresolvedContracts(nil, timeoutResolver)
if err != nil {
t.Fatalf("unable to insert contract into db: %v", err)
}
@@ -482,8 +485,9 @@ func TestContractSwapping(t *testing.T) {
htlcTimeoutResolver: timeoutResolver,
}
// We'll first insert the contest resolver into the log.
err = testLog.InsertUnresolvedContracts(contestResolver)
// We'll first insert the contest resolver into the log with no
// additional updates.
err = testLog.InsertUnresolvedContracts(nil, contestResolver)
if err != nil {
t.Fatalf("unable to insert contract into db: %v", err)
}