Merge branch 'FSM' into jl777

This commit is contained in:
jl777
2018-12-28 01:37:23 -11:00
3 changed files with 11 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ testScripts=(
'cryptoconditions_oracles.py'
'cryptoconditions_rewards.py'
'cryptoconditions_token.py'
'cryptoconditions_gateways.py'
#'cryptoconditions_gateways.py'
);
extArg="-extended"

View File

@@ -26,10 +26,10 @@ class CryptoconditionsChannelsTest(CryptoconditionsTestFramework):
rpc1 = self.nodes[1]
# getting empty channels list
result = rpc.channelsinfo()
result = rpc.channelslist()
assert_equal(len(result), 2)
assert_equal(result["result"], "success")
assert_equal(result["name"], "Channels Info")
assert_equal(result["name"], "Channels List")
# 10 payments, 100000 sat denomination channel opening with second node pubkey
new_channel_hex = rpc.channelsopen(self.pubkey1, "10", "100000")
@@ -38,13 +38,13 @@ class CryptoconditionsChannelsTest(CryptoconditionsTestFramework):
assert channel_txid, "got channel txid"
# checking if our new channel in common channels list
result = rpc.channelsinfo()
result = rpc.channelslist()
assert_equal(len(result), 3)
# checking info about channel directly
result = rpc.channelsinfo(channel_txid)
assert_success(result)
assert_equal(result["Open"], "10 payments of 100000 satoshi")
assert_equal(result["Transactions"][0]["Open"], channel_txid)
# open transaction should be confirmed
rpc.generate(1)
@@ -69,7 +69,7 @@ class CryptoconditionsChannelsTest(CryptoconditionsTestFramework):
# now in channelinfo payment information should appear
result = rpc.channelsinfo(channel_txid)
assert_equal(result["Payment"], "100000 satoshi to {}, 9 payments left".format(self.addr1))
assert_equal(result["Transactions"][1]["Payment"], payment_tx_id)
# executing channel close
result = rpc.channelsclose(channel_txid)
@@ -82,7 +82,7 @@ class CryptoconditionsChannelsTest(CryptoconditionsTestFramework):
# now in channelinfo closed flag should appear
result = rpc.channelsinfo(channel_txid)
assert_equal(result["Close"], "channel")
assert_equal(result["Transactions"][2]["Close"], channel_close_txid)
# executing channel refund
result = rpc.channelsrefund(channel_txid, channel_close_txid)

View File

@@ -207,7 +207,7 @@ bool ChannelsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &
return eval->Invalid("vin.1 is CC for channelPayment!");
else if ( IsCCInput(tx.vin[2].scriptSig) == 0 )
return eval->Invalid("vin.2 is CC for channelPayment!");
else if ( IsChannelsvout(cp,tx,srcpub,destpub,0)==0 )
else if ( tx.vout[0].scriptPubKey.IsPayToCryptoCondition()==0 )
return eval->Invalid("vout.0 is CC for channelPayment!");
else if ( IsChannelsMarkervout(cp,tx,srcpub,1)==0 )
return eval->Invalid("vout.1 is CC for channelPayment (marker to srcPub)!");
@@ -746,7 +746,7 @@ UniValue ChannelsInfo(uint256 channeltxid)
result.push_back(Pair("Channel CC address",CCaddr));
result.push_back(Pair("Destination address",addr));
result.push_back(Pair("Number of payments",param1));
result.push_back(Pair("Denomination",param2));
result.push_back(Pair("Denomination",i64tostr(param2)+" satoshi"));
result.push_back(Pair("Amount",i64tostr(param1*param2)+" satoshi"));
SetCCtxids(addressIndex,CCaddr);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
@@ -781,10 +781,11 @@ UniValue ChannelsInfo(uint256 channeltxid)
{
Getscriptaddress(str,tx.vout[3].scriptPubKey);
obj.push_back(Pair("Payment",txid.GetHex().data()));
obj.push_back(Pair("Number",param2));
obj.push_back(Pair("Number of payments",param2));
obj.push_back(Pair("Amount",param2*payment));
obj.push_back(Pair("Destination",str));
obj.push_back(Pair("Secret",param3.ToString().c_str()));
obj.push_back(Pair("Payments left",param1));
}
}
else if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,opentxid,srcpub,destpub,param1,param2,param3) == 'C' && opentxid==channeltxid)