Skip to content

Commit

Permalink
Merge #587: CreateTransaction should still print blinded tx info duri…
Browse files Browse the repository at this point in the history
…ng fundraw etc

dc1ede8 CreateTransaction should still print blinded tx info during fundraw etc (Gregory Sanders)

Pull request description:

  This should result in better diagnosing of `fundrawtransaction` behavior in case of bugs with blinding.

Tree-SHA512: 4bbd3d58f24dbb0d21fe150154c55eeb617734a2edb6211ff743448d744367e089ee8196aa06ec6fb9fb38e45ca5e1bb4c490dcb9fdda75a288fbec2112b1078
  • Loading branch information
stevenroose committed Apr 22, 2019
2 parents 5735322 + dc1ede8 commit 346c544
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3498,6 +3498,37 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac
}
}

// Print blinded transaction info before we possibly blow it away when !sign.
if (blind_details) {
std::string summary = "CreateTransaction created blinded transaction:\nIN: ";
for (unsigned int i = 0; i < selected_coins.size(); ++i) {
if (i > 0) {
summary += " ";
}
summary += strprintf("#%d: %s [%s] (%s [%s])\n", i,
selected_coins[i].value,
selected_coins[i].txout.nValue.IsExplicit() ? "explicit" : "blinded",
selected_coins[i].asset.GetHex(),
selected_coins[i].txout.nAsset.IsExplicit() ? "explicit" : "blinded"
);
}
summary += "OUT: ";
for (unsigned int i = 0; i < txNew.vout.size(); ++i) {
if (i > 0) {
summary += " ";
}
CTxOut unblinded = blind_details->tx_unblinded_unsigned.vout[i];
summary += strprintf("#%d: %s%s [%s] (%s [%s])\n", i,
txNew.vout[i].IsFee() ? "[fee] " : "",
unblinded.nValue.GetAmount(),
txNew.vout[i].nValue.IsExplicit() ? "explicit" : "blinded",
unblinded.nAsset.GetAsset().GetHex(),
txNew.vout[i].nAsset.IsExplicit() ? "explicit" : "blinded"
);
}
WalletLogPrintf(summary+"\n");
}

if (sign)
{
int nIn = 0;
Expand Down Expand Up @@ -3536,37 +3567,6 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac
strFailReason = _("Transaction too large");
return false;
}

// Print unblinded transaction overview.
if (blind_details) {
std::string summary = "CreateTransaction created blinded transaction:\nIN: ";
for (unsigned int i = 0; i < selected_coins.size(); ++i) {
if (i > 0) {
summary += " ";
}
summary += strprintf("#%d: %s [%s] (%s [%s])\n", i,
selected_coins[i].value,
selected_coins[i].txout.nValue.IsExplicit() ? "explicit" : "blinded",
selected_coins[i].asset.GetHex(),
selected_coins[i].txout.nAsset.IsExplicit() ? "explicit" : "blinded"
);
}
summary += "OUT: ";
for (unsigned int i = 0; i < tx->vout.size(); ++i) {
if (i > 0) {
summary += " ";
}
CTxOut unblinded = blind_details->tx_unblinded_unsigned.vout[i];
summary += strprintf("#%d: %s%s [%s] (%s [%s])\n", i,
tx->vout[i].IsFee() ? "[fee] " : "",
unblinded.nValue.GetAmount(),
tx->vout[i].nValue.IsExplicit() ? "explicit" : "blinded",
unblinded.nAsset.GetAsset().GetHex(),
tx->vout[i].nAsset.IsExplicit() ? "explicit" : "blinded"
);
}
WalletLogPrintf(summary+"\n");
}
}

if (gArgs.GetBoolArg("-walletrejectlongchains", DEFAULT_WALLET_REJECT_LONG_CHAINS)) {
Expand Down

0 comments on commit 346c544

Please sign in to comment.