summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbbroder-algo <92406993+bbroder-uji@users.noreply.github.com>2023-05-17 01:58:45 -0400
committerbbroder-algo <92406993+bbroder-uji@users.noreply.github.com>2023-05-17 01:58:45 -0400
commit0ab325145e3250efed6b8d2bc944f3241ea5fdbc (patch)
treef48759ee92bd83460dde4cb46b8457f2af0a3044
parentc05bffb36ecd9a91c1ccb84031948c6060a65306 (diff)
roothashbob_merkle
-rw-r--r--data/bookkeeping/block.go3
-rw-r--r--ledger/bobtracker.go12
2 files changed, 9 insertions, 6 deletions
diff --git a/data/bookkeeping/block.go b/data/bookkeeping/block.go
index 344148afa..e431b69d6 100644
--- a/data/bookkeeping/block.go
+++ b/data/bookkeeping/block.go
@@ -49,6 +49,9 @@ type (
// TxnCommitments authenticates the set of transactions appearing in the block.
TxnCommitments
+ // Sha256StateCommitment authenticates the blockchain state after block transactions.
+ Sha256StateCommitment crypto.Digest `codec:"stc256"`
+
// TimeStamp in seconds since epoch
TimeStamp int64 `codec:"ts"`
diff --git a/ledger/bobtracker.go b/ledger/bobtracker.go
index 32d4af00b..46843e6cb 100644
--- a/ledger/bobtracker.go
+++ b/ledger/bobtracker.go
@@ -220,7 +220,7 @@ func (ct *bobTracker) commitRound(ctx context.Context, tx trackerdb.TransactionS
dcc.stats.BobMerkleTrieUpdateDuration = now - dcc.stats.BobMerkleTrieUpdateDuration
ct.log.Infof("bobtracker -- commitround duration %d", dcc.stats.BobMerkleTrieUpdateDuration)
- err = arw.UpdateAccountsHashRound(ctx, treeTargetRound)
+ err = arw.UpdateAccountsBobHashRound(ctx, treeTargetRound)
if err != nil {
return err
}
@@ -388,7 +388,7 @@ func (ct *bobTracker) initializeHashes(ctx context.Context, tx trackerdb.Transac
if err != nil {
return err
}
- hashRound, err := arw.AccountsHashRound(ctx)
+ hashRound, err := arw.AccountsBobHashRound(ctx)
if err != nil {
return err
}
@@ -478,7 +478,7 @@ func (ct *bobTracker) initializeHashes(ctx context.Context, tx trackerdb.Transac
// if it's not ordered, we can ignore it for now; we'll just increase the counters and emit logs periodically.
if time.Since(lastRebuildTime) > 5*time.Second {
// let the user know that the trie is still being rebuilt.
- ct.log.Infof("initializeHashes still building the trie, and hashed so far %d accounts", totalOrderedAccounts)
+ ct.log.Infof("initializeHashes still building the bob trie, and hashed so far %d accounts", totalOrderedAccounts)
lastRebuildTime = time.Now()
}
}
@@ -488,7 +488,7 @@ func (ct *bobTracker) initializeHashes(ctx context.Context, tx trackerdb.Transac
// if anything goes wrong, it will still get rolled back.
_, err = trie.Evict(true)
if err != nil {
- return fmt.Errorf("initializeHashes was unable to commit changes to trie: %v", err)
+ return fmt.Errorf("initializeHashes was unable to commit changes to bob trie: %v", err)
}
// Now add the kvstore hashes
@@ -508,7 +508,7 @@ func (ct *bobTracker) initializeHashes(ctx context.Context, tx trackerdb.Transac
pendingTrieHashes++
added, err := trie.Add(hash)
if err != nil {
- return fmt.Errorf("initializeHashes was unable to add kv (key=%s) to trie: %v", hex.EncodeToString(k), err)
+ return fmt.Errorf("initializeHashes was unable to add kv (key=%s) to bob trie: %v", hex.EncodeToString(k), err)
}
if !added {
ct.log.Warnf("initializeHashes attempted to add duplicate kv hash '%s' to bob merkle trie for key %s", hex.EncodeToString(hash), k)
@@ -533,7 +533,7 @@ func (ct *bobTracker) initializeHashes(ctx context.Context, tx trackerdb.Transac
}
// we've just updated the bob merkle trie, update the hashRound to reflect that.
- err = arw.UpdateAccountsHashRound(ctx, rnd)
+ err = arw.UpdateAccountsBobHashRound(ctx, rnd)
if err != nil {
return fmt.Errorf("initializeHashes was unable to update the account hash round to %d: %v", rnd, err)
}