Skip to content

Commit 8aa9d1e

Browse files
committed
tapdb: remove extra call to applySupplyUpdatesInternal
The call is idempotent so not explcitily a bug, but we have two calls to the function here. Likely was a rebase issue.
1 parent d2e6d74 commit 8aa9d1e

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

tapdb/supply_commit.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,16 +1326,6 @@ func (s *SupplyCommitMachine) ApplyStateTransition(
13261326
dbTransition := dbTransitionRow.SupplyCommitTransition
13271327
transitionID := dbTransition.TransitionID
13281328

1329-
// Next, we'll apply all the pending updates to the supply
1330-
// sub-trees, then use that to update the root tree.
1331-
_, err = applySupplyUpdatesInternal(
1332-
ctx, db, assetSpec, transition.PendingUpdates,
1333-
)
1334-
if err != nil {
1335-
return fmt.Errorf("failed to apply SMT updates: "+
1336-
"%w", err)
1337-
}
1338-
13391329
// Next, we'll update the supply commitment data, before we do
13401330
// that, perform some basic sanity checks.
13411331
if !dbTransition.NewCommitmentID.Valid {
@@ -1349,15 +1339,19 @@ func (s *SupplyCommitMachine) ApplyStateTransition(
13491339
}
13501340
chainTxnID := dbTransition.PendingCommitTxnID.Int64
13511341

1352-
// Update the commitment record with the calculated root hash
1353-
// and sum.
1342+
// Next, we'll apply all the pending updates to the supply
1343+
// sub-trees, then use that to update the root tree.
1344+
//
13541345
finalRootSupplyRoot, err := applySupplyUpdatesInternal(
13551346
ctx, db, assetSpec, transition.PendingUpdates,
13561347
)
13571348
if err != nil {
13581349
return fmt.Errorf("failed to apply SMT updates: "+
13591350
"%w", err)
13601351
}
1352+
1353+
// Update the commitment record with the calculated root hash
1354+
// and sum.
13611355
finalRootHash := finalRootSupplyRoot.NodeHash()
13621356
finalRootSum := finalRootSupplyRoot.NodeSum()
13631357
err = db.UpdateSupplyCommitmentRoot(

0 commit comments

Comments
 (0)