Merge ElementsProject/elements#984: Address problems raised in #935 (0.21 rebase)

f2a0050f31 primitives: do not de/serialize asset issuance in bitcoin mode (Andrew Poelstra)
9c1de4d85f ci: give more memory to a couple Cirrus jobs (Andrew Poelstra)
40c09f637c rpc: fix error message accidentally changed in 5e62edc (Andrew Poelstra)
adbd9f163a qt: fix PSBT/PSET change from 4839db857d (Andrew Poelstra)
057237bd02 qt: fix double-scoping of enum introduced in c3b6bbb (Andrew Poelstra)
5819f25975 bitcoin-tx: add ASSET to the help text of some option (Andrew Poelstra)
1f3cfb451a chainparamsbase: fix bool-vs-enum mistake in 9c3480fea9 (Andrew Poelstra)
2573747447 fix test code duplication from 3a0de44d90 (Andrew Poelstra)
0045cafd75 rpc/mining: restore code erroneously dropped in 0e2c963dbf (Andrew Poelstra)
39112e1eaa correct copy/paste error in error message (Andrew Poelstra)

Pull request description:

ACKs for top commit:
  stevenroose:
    utACK f2a0050

Tree-SHA512: 5ce831ef24e51e76b93cd4d8e345a382dbd716e38c99565a7c2f25b5eeb8bac1e36c623491c5763ceb7b47444024b5821a878942df150bb01b33eeae33f292b1
This commit is contained in:
Steven Roose 2021-05-06 15:33:35 +01:00
commit 108e1ba7bb
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
10 changed files with 15 additions and 15 deletions

View file

@ -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"
@ -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"

View file

@ -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. "

View file

@ -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);

View file

@ -146,7 +146,7 @@ public:
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;
@ -189,7 +189,7 @@ public:
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;

View file

@ -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);

View file

@ -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;
}

View file

@ -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()) {

View file

@ -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.

View file

@ -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;

View file

@ -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