Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mint with external asset group PSBT signer #1210

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tapgarden: move sanity check into buildGroupReqs
Simplifies the code by ensuring the consistency check for group requests
and virtual transactions is handled within the buildGroupReqs function.
This removes redundant checks from multiple call sites.
ffranr committed Nov 21, 2024
commit eae7bc4b88c87d38401b0557b8c9c8445f484902
16 changes: 7 additions & 9 deletions tapgarden/planter.go
Original file line number Diff line number Diff line change
@@ -766,6 +766,13 @@ func buildGroupReqs(genesisPoint wire.OutPoint, assetOutputIndex uint32,
}
}

// Verify consistency: ensure the number of group key requests matches
// the number of group VM transactions.
if len(groupReqs) != len(genTXs) {
return nil, nil, fmt.Errorf("mismatched number of group " +
"requests and virtual TXs")
}

return groupReqs, genTXs, nil
}

@@ -1053,11 +1060,6 @@ func listBatches(ctx context.Context, batchStore MintingStore,
"requests: %w", err)
}

if len(groupReqs) != len(genTXs) {
return nil, fmt.Errorf("mismatched number of group " +
"requests and virtual TXs")
}

// Copy existing seedlngs into the unsealed seedling map; we'll
// clear the batch seedlings after adding group information.
currentBatch.UnsealedSeedlings = make(
@@ -1627,10 +1629,6 @@ func (c *ChainPlanter) sealBatch(ctx context.Context, params SealParams,
return nil, fmt.Errorf("unable to build group requests: "+
"%w", err)
}
if len(groupReqs) != len(genTXs) {
return nil, fmt.Errorf("mismatched number of group requests " +
"and virtual TXs")
}

// Each provided group witness must have a corresponding seedling in the
// current batch.