| 291 | } |
| 292 | |
| 293 | bool PartiallySignedTransaction::AddOutput(const PSBTOutput& psbtout) |
| 294 | { |
| 295 | if (psbtout.amount == std::nullopt || psbtout.script == std::nullopt) { |
| 296 | return false; |
| 297 | } |
| 298 | |
| 299 | if (tx != std::nullopt) { |
| 300 | // This is a v0 psbt, do the v0 AddOutput |
| 301 | CTxOut txout(CAsset(), *psbtout.amount, *psbtout.script); |
| 302 | tx->vout.push_back(txout); |
| 303 | outputs.push_back(psbtout); |
| 304 | return true; |
| 305 | } |
| 306 | |
| 307 | // No global tx, must be PSBTv2 |
| 308 | // Check outputs are modifiable |
| 309 | if (m_tx_modifiable == std::nullopt || !m_tx_modifiable->test(1)) { |
| 310 | return false; |
| 311 | } |
| 312 | outputs.push_back(psbtout); |
| 313 | |
| 314 | return true; |
| 315 | } |
| 316 | |
| 317 | bool PSBTInput::GetUTXO(CTxOut& utxo) const |
| 318 | { |