mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
Merge 914c0cad97 into merged_master (Bitcoin PR bitcoin/bitcoin#22399)
This PR adds a fuzz test ensuring that all the different destination types round-trip to strings (an important test given that Satoshi managed to mess this up, having two different address types encode the same way..) Anyway we fail this test, since both CNoDestination and NullData encode as empty strings, and then this "decodes" as CNoDestination (and returns an error, but the fuzztest doesn't check that). To make the fuzzer pass, I changed NullData to encode and decode as "null". I think this actually adds some functionality, letting you use "null" as an "address" for sendtoaddress and createrawtransaction, thus burning the coins and fixing #1011...but this was not my intent and we probably want to think a bit more carefully before deliberately supporting this.
This commit is contained in:
commit
e4746d6297
6 changed files with 69 additions and 77 deletions
|
|
@ -127,11 +127,14 @@ public:
|
|||
}
|
||||
|
||||
std::string operator()(const CNoDestination& no) const { return {}; }
|
||||
std::string operator()(const NullData& null) const { return {}; }
|
||||
std::string operator()(const NullData& null) const { return "null"; }
|
||||
};
|
||||
|
||||
CTxDestination DecodeDestination(const std::string& str, const CChainParams& params, const bool for_parent, std::string& error_str)
|
||||
{
|
||||
// ELEMENTS: special case nulldata as "null"
|
||||
if (str == "null") return NullData{};
|
||||
|
||||
std::vector<unsigned char> data;
|
||||
size_t pk_size = CPubKey::COMPRESSED_SIZE;
|
||||
uint160 hash;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue