Skip to content

Commit

Permalink
Merge #984: Address problems raised in #935 (0.21 rebase)
Browse files Browse the repository at this point in the history
f2a0050 primitives: do not de/serialize asset issuance in bitcoin mode (Andrew Poelstra)
9c1de4d ci: give more memory to a couple Cirrus jobs (Andrew Poelstra)
40c09f6 rpc: fix error message accidentally changed in 5e62edc (Andrew Poelstra)
adbd9f1 qt: fix PSBT/PSET change from 4839db8 (Andrew Poelstra)
057237b qt: fix double-scoping of enum introduced in c3b6bbb (Andrew Poelstra)
5819f25 bitcoin-tx: add ASSET to the help text of some option (Andrew Poelstra)
1f3cfb4 chainparamsbase: fix bool-vs-enum mistake in 9c3480f (Andrew Poelstra)
2573747 fix test code duplication from 3a0de44 (Andrew Poelstra)
0045caf rpc/mining: restore code erroneously dropped in 0e2c963 (Andrew Poelstra)
39112e1 correct copy/paste error in error message (Andrew Poelstra)

Pull request description:

ACKs for top commit:
  stevenroose:
    utACK f2a0050

Tree-SHA512: 5ce831ef24e51e76b93cd4d8e345a382dbd716e38c99565a7c2f25b5eeb8bac1e36c623491c5763ceb7b47444024b5821a878942df150bb01b33eeae33f292b1
  • Loading branch information
stevenroose committed May 6, 2021
2 parents 4db1799 + f2a0050 commit 108e1ba
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
5 changes: 4 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ task:
<< : *GLOBAL_TASK_TEMPLATE
container:
image: ubuntu:focal
memory: 12G # ELEMENTS: need more memory
memory: 16G # ELEMENTS: need more memory
cpu: 4 # ELEMENTS: cirrus wants more CPUs if you want more memory
env:
FILE_ENV: "./ci/test/00_setup_env_native_asan.sh"

Expand All @@ -112,6 +113,8 @@ task:
<< : *GLOBAL_TASK_TEMPLATE
container:
image: ubuntu:focal
memory: 16G # ELEMENTS: need more memory
cpu: 4 # ELEMENTS: cirrus wants more CPUs if you want more memory
env:
FILE_ENV: "./ci/test/00_setup_env_native_fuzz.sh"

Expand Down
2 changes: 1 addition & 1 deletion src/bitcoin-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void SetupBitcoinTxArgs(ArgsManager &argsman)
argsman.AddArg("in=TXID:VOUT(:SEQUENCE_NUMBER)", "Add input to TX", ArgsManager::ALLOW_ANY, OptionsCategory::COMMANDS);
argsman.AddArg("locktime=N", "Set TX lock time to N", ArgsManager::ALLOW_ANY, OptionsCategory::COMMANDS);
argsman.AddArg("nversion=N", "Set TX version to N", ArgsManager::ALLOW_ANY, OptionsCategory::COMMANDS);
argsman.AddArg("outaddr=VALUE:ADDRESS", "Add address-based output to TX", ArgsManager::ALLOW_ANY, OptionsCategory::COMMANDS);
argsman.AddArg("outaddr=VALUE:ADDRESS(:ASSET)", "Add address-based output to TX", ArgsManager::ALLOW_ANY, OptionsCategory::COMMANDS);
argsman.AddArg("outdata=[VALUE:]DATA", "Add data-based output to TX", ArgsManager::ALLOW_ANY, OptionsCategory::COMMANDS);
argsman.AddArg("outmultisig=VALUE:REQUIRED:PUBKEYS:PUBKEY1:PUBKEY2:....[:FLAGS]", "Add Pay To n-of-m Multi-sig output to TX. n = REQUIRED, m = PUBKEYS. "
"Optionally add the \"W\" flag to produce a pay-to-witness-script-hash output. "
Expand Down
2 changes: 1 addition & 1 deletion src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
argsman.AddArg("-con_connect_genesis_outputs", "Connect outputs in genesis block to utxo database.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
argsman.AddArg("-con_elementsmode", "Use Elements-like instead of Core-like witness encoding. This is required for CA/CT. (default: true)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
argsman.AddArg("-con_blockheightinheader", "Whether the chain includes the block height directly in the header, for easier validation of block height in low-resource environments. (default: true)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-con_genesis_style=<style>", "Use genesis style <style> (default: elements). Results in genesis block compatibility with various networks. Allowed values: elements, bitcoin", true, OptionsCategory::ELEMENTS);
argsman.AddArg("-con_genesis_style=<style>", "Use genesis style <style> (default: elements). Results in genesis block compatibility with various networks. Allowed values: elements, bitcoin", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::ELEMENTS);
argsman.AddArg("-con_signed_blocks", "Signed blockchain. Uses input of `-signblockscript` to define what signatures are necessary to solve it.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-signblockscript", "Signed blockchain enumberance. Only active when `-con_signed_blocks` set to true.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-con_max_block_sig_size", "Max allowed witness data for the signed block header.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
Expand Down
4 changes: 2 additions & 2 deletions src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class CTxIn
inline void Serialize(Stream& s) const {
bool fHasAssetIssuance;
COutPoint outpoint;
if (prevout.n == (uint32_t) -1) {
if (!g_con_elementsmode || prevout.n == (uint32_t) -1) {
// Coinbase inputs do not have asset issuances attached
// to them.
fHasAssetIssuance = false;
Expand Down Expand Up @@ -189,7 +189,7 @@ class CTxIn
COutPoint outpoint;
s >> outpoint;

if (outpoint.n == (uint32_t) -1) {
if (!g_con_elementsmode || outpoint.n == (uint32_t) -1) {
// No asset issuance for Coinbase inputs.
fHasAssetIssuance = false;
prevout = outpoint;
Expand Down
4 changes: 2 additions & 2 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ void BitcoinGUI::createActions()
signMessageAction->setStatusTip(tr("Sign messages with your %1 addresses to prove you own them").arg("Liquid"));
verifyMessageAction = new QAction(tr("&Verify message..."), this);
verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified %1 addresses").arg("Liquid"));
m_load_psbt_action = new QAction(tr("&Load PSBT from file..."), this);
m_load_psbt_action = new QAction(tr("&Load PSET from file..."), this);
m_load_psbt_action->setStatusTip(tr("Load Partially Signed Elements Transaction"));
m_load_psbt_clipboard_action = new QAction(tr("Load PSBT from clipboard..."), this);
m_load_psbt_clipboard_action = new QAction(tr("Load PSET from clipboard..."), this);
m_load_psbt_clipboard_action->setStatusTip(tr("Load Partially Signed Elements Transaction from clipboard"));

openRPCConsoleAction = new QAction(tr("Node window"), this);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ void SendCoinsDialog::on_sendButton_clicked()
fileNameSuggestion.append(" - ");
}
QString labelOrAddress = rcp.label.isEmpty() ? rcp.address : rcp.label;
QString amount = GUIUtil::formatAssetAmount(rcp.asset, rcp.asset_amount, bitcoin_unit, BitcoinUnits::BitcoinUnits::SeparatorStyle::STANDARD, true);
QString amount = GUIUtil::formatAssetAmount(rcp.asset, rcp.asset_amount, bitcoin_unit, BitcoinUnits::SeparatorStyle::STANDARD, true);
fileNameSuggestion.append(labelOrAddress + "-" + amount);
first = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static bool GenerateBlock(ChainstateManager& chainman, CBlock& block, uint64_t&
++block.nNonce;
--max_tries;
}
if (max_tries == 0) {
if (max_tries == 0 || ShutdownRequested()) {
return false;
}
if (block.nNonce == std::numeric_limits<uint32_t>::max()) {
Expand Down
2 changes: 1 addition & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3760,7 +3760,7 @@ static bool ContextualCheckDynaFedHeader(const CBlockHeader& block, BlockValidat
int fedpeg_version = 0;
std::vector<unsigned char> fedpeg_program;
if (!proposed.m_fedpeg_program.IsWitnessProgram(fedpeg_version, fedpeg_program)) {
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "invalid-dyna-fed", "proposed signblockscript must be native segwit scriptPubkey");
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "invalid-dyna-fed", "proposed fedpeg program must be native segwit scriptPubkey");
}

// for v0, fedpegscript's scriptPubKey must match. v1+ is unencumbered.
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3340,7 +3340,7 @@ void FundTransaction(CWallet* const pwallet, CMutableTransaction& tx, CAmount& f
destinations[asset] = dest;
}
} else {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Change address must be a valid address");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Change address must be either a map or a string");
}

coinControl.destChange = destinations;
Expand Down
5 changes: 1 addition & 4 deletions test/functional/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,9 @@ def gen_return_txouts():
txouts = []
from .messages import CTxOut, CTxOutValue
txout = CTxOut()
txout.nValue = 0
txout.nValue = CTxOutValue(0)
txout.scriptPubKey = hex_str_to_bytes(script_pubkey)
for _ in range(128):
txout = CTxOut()
txout.nValue = CTxOutValue(0)
txout.scriptPubKey = hex_str_to_bytes(script_pubkey)
txouts.append(txout)
return txouts

Expand Down

0 comments on commit 108e1ba

Please sign in to comment.