Skip to content

fix(master-express): forward walletPubs in consolidateUnspents and accelerate#200

Open
bitgo-ai-agent-dev[bot] wants to merge 2 commits intomasterfrom
pranavjain/wcn-447-fix-wallet-pubs-consolidate-accelerate
Open

fix(master-express): forward walletPubs in consolidateUnspents and accelerate#200
bitgo-ai-agent-dev[bot] wants to merge 2 commits intomasterfrom
pranavjain/wcn-447-fix-wallet-pubs-consolidate-accelerate

Conversation

@bitgo-ai-agent-dev
Copy link
Copy Markdown

Summary

  • consolidateUnspents and accelerate were failing for UTXO coins (BTC/tBTC) with "pubs are required for fixed script signing" because makeCustomSigningFunction did not forward walletPubs to awmClient.signMultisig
  • Both handlers now fetch all 3 keychains (user, backup, bitgo) in parallel and pass walletPubs into makeCustomSigningFunction, matching the fix already in place for sendMany
  • makeCustomSigningFunction in utils.ts updated to accept and forward the optional walletPubs parameter

Root Cause

makeCustomSigningFunction only forwarded txPrebuild, source, and pub to the AWM client. Without walletPubs, coin.signTransaction() on the AWM side was called without pubs, hitting the assertion added in commit c25b99b.

Test Plan

  • Two new tests added to consolidateUnspents.test.ts: verify walletPubs is passed to AWM sign request, and verify it is omitted when any keychain lacks a pub
  • Two new tests added to accelerate.test.ts with identical coverage
  • All existing tests for both endpoints remain unchanged and should continue to pass

Ticket: WCN-447

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot requested a review from a team as a code owner May 7, 2026 19:57
@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot requested a review from bdesoky May 7, 2026 19:57
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 7, 2026

WCN-447

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot force-pushed the pranavjain/wcn-447-fix-wallet-pubs-consolidate-accelerate branch 2 times, most recently from b1caf30 to e7341a9 Compare May 7, 2026 20:18
consolidateUnspents and accelerate were failing for UTXO coins with
"pubs are required for fixed script signing" after the SDK bump added
assert(params.pubs) in abstract-utxo BitGoPsbt signing path.

Update makeCustomSigningFunction to accept and forward walletPubs to
awmClient.signMultisig. Update handleConsolidateUnspents and
handleAccelerate to fetch all 3 keychains (user, backup, bitgo) and
pass them as walletPubs, matching the sendMany flow.

Ticket: WCN-447
Session-Id: 79c78e55-7d60-4e54-b656-da465c33eb23
Task-Id: 7abc45de-23d0-4914-8dad-885882f82710
The walletPubs logic fetches all 3 keychains after getWalletAndSigningKeychain.
Tests using nock.disableNetConnect() were missing mocks for the backup
and bitgo keychain requests, causing 500s in success-path tests.

Ticket: WCN-447
Session-Id: 79c78e55-7d60-4e54-b656-da465c33eb23
Task-Id: 7abc45de-23d0-4914-8dad-885882f82710
@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot force-pushed the pranavjain/wcn-447-fix-wallet-pubs-consolidate-accelerate branch 2 times, most recently from 7598526 to 8935385 Compare May 7, 2026 20:26
KeyIndices,
});

const [userKeychain, backupKeychain, bitgoKeychain] = await Promise.all([
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we create a util func for this:

const [userKeychain, backupKeychain, bitgoKeychain] = await Promise.all([  
    baseCoin.keychains().get({ id: wallet.keyIds()[KeyIndices.USER] }),
    baseCoin.keychains().get({ id: wallet.keyIds()[KeyIndices.BACKUP] }),
    baseCoin.keychains().get({ id: wallet.keyIds()[KeyIndices.BITGO] }),
  ]);
  const walletPubs =
    userKeychain?.pub && backupKeychain?.pub && bitgoKeychain?.pub
      ? [userKeychain.pub, backupKeychain.pub, bitgoKeychain.pub]
      : undefined;

return walletPubs;

and use it in both the places so we can just edit things in one place later?

const coin = req.params.coin;

const { wallet, signingKeychain } = await getWalletAndSigningKeychain({
const { baseCoin, wallet, signingKeychain } = await getWalletAndSigningKeychain({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we do the same at handleConsolidate or no?

customSigningFunction: makeCustomSigningFunction({
awmClient,
source: params.source,
pub: signingKeychain.pub!,
}),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants