4 Commits

Author SHA1 Message Date
Patrick Lodder
a8e8726ebf
rpc: parse auxpow submissions early and safely
- Add core_io function DecodeAuxPow implementing a save means to
  parse a hex encoded auxpow string into a CAuxPow instance
- Parse both the hash and the hex in the receiving methods, and
  return meaningful errors when they fail.
  1. Providing a malformed hash now returns RPC_INVALID_PARAMETER
     (-8) instead of the generic -1
  2. Providing a malformed auxpow hex now returns
     RPC_DESERIALIZATION_ERROR (-22) instead of the generic -1
2025-05-13 09:15:18 -04:00
Patrick Lodder
04e932789d
cleanup: remove getauxblockbip22
Merges getauxblockbip22 into getauxblock, to decrease code
complexity.
2025-05-13 09:15:18 -04:00
Patrick Lodder
f17f58b9eb
rpc: unify auxpow methods
1. Introduces a single cache for templated blocks CAuxBlockCache
   that is indexed and searchable by both coinbase script and
   block hash.
2. Integrates the new cache into AuxMiningCreateBlock and
   AuxMiningSubmitBlock rpc helper functions
3. Modifies AuxMiningSubmitBlock to return the BIP-22 response
4. Modifies getauxblockbip22 to user AuxMiningSubmitBlock

Note that although we return the BIP-22 response in
AuxMiningSubmitBlock and getauxblockbip22, there is currently no
method or configuration that returns this over rpc. All methods
return a boolean response. This remains unchanged for backward
compatibility.
2025-05-13 09:15:17 -04:00
Patrick Lodder
26ba62da59
rpc: moveonly: untangle auxpow from rpc/mining.cpp
Aims to isolate auxpow code for readability and to make a clear
demarcation for this custom Dogecoin functionality. Only moves
code.

- Creates a header for mining/auxpow shared usage containing
  common functions between these functions.
- Moves all auxpow RPC methods into rpc/auxpow.cpp
2025-05-02 14:09:08 -04:00