| 330 | } |
| 331 | |
| 332 | bool SignTransaction(CWallet& wallet, CMutableTransaction& mtx) { |
| 333 | LOCK(wallet.cs_wallet); |
| 334 | |
| 335 | if (wallet.IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER)) { |
| 336 | // Make a blank psbt |
| 337 | PartiallySignedTransaction psbtx(mtx); |
| 338 | |
| 339 | // First fill transaction with our data without signing, |
| 340 | // so external signers are not asked to sign more than once. |
| 341 | bool complete; |
| 342 | wallet.FillPSBT(psbtx, {.sign = false, .bip32_derivs = true}, complete); |
| 343 | auto err{wallet.FillPSBT(psbtx, {.sign = true, .bip32_derivs = false}, complete)}; |
| 344 | if (err) return false; |
| 345 | complete = FinalizeAndExtractPSBT(psbtx, mtx); |
| 346 | return complete; |
| 347 | } else { |
| 348 | return wallet.SignTransaction(mtx); |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | Result CommitTransaction(CWallet& wallet, const Txid& txid, CMutableTransaction&& mtx, std::vector<bilingual_str>& errors, Txid& bumped_txid) |
| 353 | { |