| 2555 | } |
| 2556 | |
| 2557 | bool CWallet::SignTransaction(CMutableTransaction &tx, bool no_forkid) |
| 2558 | { |
| 2559 | AssertLockHeld(cs_wallet); // mapWallet |
| 2560 | |
| 2561 | // sign the new tx |
| 2562 | int nIn = 0; |
| 2563 | for (auto& input : tx.vin) { |
| 2564 | std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(input.prevout.hash); |
| 2565 | if(mi == mapWallet.end() || input.prevout.n >= mi->second.tx->vout.size()) { |
| 2566 | return false; |
| 2567 | } |
| 2568 | const CScript& scriptPubKey = mi->second.tx->vout[input.prevout.n].scriptPubKey; |
| 2569 | const CAmount& amount = mi->second.tx->vout[input.prevout.n].nValue; |
| 2570 | SignatureData sigdata; |
| 2571 | const int sighash_flag = no_forkid ? SIGHASH_ALL : SIGHASH_ALL | SIGHASH_FORKID; |
| 2572 | if (!ProduceSignature(*this, MutableTransactionSignatureCreator(&tx, nIn, amount, no_forkid, sighash_flag), scriptPubKey, sigdata, no_forkid)) { |
| 2573 | return false; |
| 2574 | } |
| 2575 | UpdateInput(input, sigdata); |
| 2576 | nIn++; |
| 2577 | } |
| 2578 | return true; |
| 2579 | } |
| 2580 | |
| 2581 | bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nChangePosInOut, std::string& strFailReason, bool lockUnspents, const std::set<int>& setSubtractFeeFromOutputs, CCoinControl coinControl) |
| 2582 | { |
no test coverage detected