forked from lthn/blockchain
wallet: more rules for contract proposal validation (a_pledge > 0 && b_pledge + amount_to_pay > 0)
This commit is contained in:
parent
71515cded2
commit
7a65919fba
2 changed files with 5 additions and 2 deletions
|
|
@ -1396,9 +1396,9 @@ namespace currency
|
|||
//-----------------------------------------------------------------------------------------------
|
||||
bool check_outs_valid(const transaction& tx)
|
||||
{
|
||||
BOOST_FOREACH(const tx_out& out, tx.vout)
|
||||
for(const tx_out& out : tx.vout)
|
||||
{
|
||||
CHECK_AND_NO_ASSERT_MES(0 < out.amount, false, "zero amount ouput in transaction id=" << get_transaction_hash(tx));
|
||||
CHECK_AND_NO_ASSERT_MES(0 < out.amount, false, "zero amount output in transaction id=" << get_transaction_hash(tx));
|
||||
if (out.target.type() == typeid(txout_to_key))
|
||||
{
|
||||
if (!check_key(boost::get<txout_to_key>(out.target).key))
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ bool wallet2::validate_escrow_proposal(const wallet_rpc::wallet_transfer_info& w
|
|||
bool correct_keys = (ms.keys[0] == a_key && ms.keys[1] == b_key) || (ms.keys[0] == b_key && ms.keys[1] == a_key);
|
||||
LOC_CHK(correct_keys, "template has mulisig output with invalid keys: 0:" << ms.keys[0] << " 1:" << ms.keys[1]);
|
||||
|
||||
LOC_CHK(cpd.amount_a_pledge > 0, "template has zero a pledge");
|
||||
LOC_CHK(cpd.amount_b_pledge + cpd.amount_to_pay > 0, "template has zero (b pledge + amount to pay)");
|
||||
|
||||
uint64_t min_ms_amount = cpd.amount_a_pledge + cpd.amount_b_pledge + cpd.amount_to_pay + TX_DEFAULT_FEE;
|
||||
LOC_CHK(ms_amount >= min_ms_amount, "template multisig amount " << ms_amount << " is less than contract expected value: " << min_ms_amount << ", a_pledge=" << cpd.amount_a_pledge << ", b_pledge=" << cpd.amount_b_pledge << ", amount_to_pay=" << cpd.amount_to_pay);
|
||||
uint64_t min_a_inputs = cpd.amount_a_pledge + cpd.amount_to_pay;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue