diff --git a/src/blsct/arith/elements.cpp b/src/blsct/arith/elements.cpp index c429872dd997b..070fd6d44734a 100644 --- a/src/blsct/arith/elements.cpp +++ b/src/blsct/arith/elements.cpp @@ -200,7 +200,6 @@ template void Elements::ConfirmIndexInsideRange(const uint32_t& index) const { if (index >= m_vec.size()) { - assert(0); auto s = strprintf("index %d is out of range [0..%d]", index, m_vec.size() - 1ul); throw std::runtime_error(s); } diff --git a/src/blsct/range_proof/bulletproofs_plus/range_proof.h b/src/blsct/range_proof/bulletproofs_plus/range_proof.h index 4422c7f6bcda5..3538004728771 100644 --- a/src/blsct/range_proof/bulletproofs_plus/range_proof.h +++ b/src/blsct/range_proof/bulletproofs_plus/range_proof.h @@ -105,6 +105,14 @@ struct RangeProofWithSeed : public RangeProof { typename T::Scalar min_value; }; +template +struct RangeProofUncompressed { + FORMATTER_METHODS(RangeProof, obj) + { + READWRITE(Using>(obj), obj.A, obj.A_wip, obj.B, obj.r_prime, obj.s_prime, obj.delta_prime, obj.alpha_hat, obj.tau_x); + } +}; + } // namespace bulletproofs_plus #endif // NAVIO_BLSCT_RANGE_PROOF_BULLETPROOFS_PLUS_RANGE_PROOF_H diff --git a/src/blsct/range_proof/proof_base.h b/src/blsct/range_proof/proof_base.h index fb1d0d119a4c8..1563780b06dfe 100644 --- a/src/blsct/range_proof/proof_base.h +++ b/src/blsct/range_proof/proof_base.h @@ -50,6 +50,11 @@ struct ProofBase { } }; +template +struct ProofBaseUncompressed { + FORMATTER_METHODS(ProofBase, obj) { READWRITE(obj.Vs, obj.Ls, obj.Rs); } +}; + } // namespace range_proof #endif // NAVIO_BLSCT_RANGE_PROOF_PROOF_BASE_H diff --git a/src/blsct/wallet/txfactory_global.cpp b/src/blsct/wallet/txfactory_global.cpp index 98b83f5e37eca..1b0f05d94278e 100644 --- a/src/blsct/wallet/txfactory_global.cpp +++ b/src/blsct/wallet/txfactory_global.cpp @@ -120,7 +120,7 @@ UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destKeys, const CAmoun stakeRp.Vs.Clear(); DataStream ss{}; - ss << stakeRp; + ss << Using>(stakeRp); ret.out.scriptPubKey = CScript() << OP_STAKED_COMMITMENT << blsct::Common::DataStreamToVector(ss) << OP_DROP << OP_TRUE; } diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 0a8f7023680c4..e4df4bdd72d39 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -324,12 +324,17 @@ class CTxOut { if (!HasBLSCTRangeProof()) return false; + if (scriptPubKey.size() <= 7) return false; + if (blsctData.rangeProof.Vs.Size() == 0) return false; + if (!tokenId.IsNull()) return false; + if (!(*(scriptPubKey.begin()) == OP_STAKED_COMMITMENT && *(scriptPubKey.begin() + 1) == OP_PUSHDATA2 && *(scriptPubKey.end() - 1) == OP_TRUE)) return false; + try { auto commitment = std::vector(scriptPubKey.begin() + 4, scriptPubKey.end());