dsproofs: Fix "score" RPC for non-SIGHASH_ALL and SIGHASH_ANYONECANPAY

Summary

As per the dsproof spec, any txns containing inputs that are not signed with SIGHASH_ALL or that are signed with SIGHASH_ANYONECANPAY are not guaranteed to be protected by dsproofs (due to reasons such as mutability of txns or inability to generate a convincing proof in some cases).

As such, the getdsproofscore RPC should indicate this in the scoring. This MR modifies the RPC to return a score of 0.25 if a txn or any of its in-mempool ancestors happens to have a P2PKH input that is not signed with SIGHASH_ALL or is signed with SIGHASH_ANYONECANPAY.

A functional test case was added to test for this.

Additionally, some code was refactored to improve performance for getdsproofscore by reducing redundant copying of CTransaction -> CMutableTransaction when calling DataFromTransaction in the dsproof subsystem.

Test Plan

  • ninja all check-all

Merge request reports

Loading