@@ -1,9 +1,9 @@
|
|||||||
OSX_MIN_VERSION=10.8
|
OSX_MIN_VERSION=10.12
|
||||||
OSX_SDK_VERSION=10.11
|
OSX_SDK_VERSION=10.12
|
||||||
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
|
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
|
||||||
LD64_VERSION=253.9
|
LD64_VERSION=253.9
|
||||||
darwin_CC=gcc-6 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
|
darwin_CC=gcc-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
|
||||||
darwin_CXX=g++-6 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
|
darwin_CXX=g++-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
|
||||||
|
|
||||||
darwin_CFLAGS=-pipe
|
darwin_CFLAGS=-pipe
|
||||||
darwin_CXXFLAGS=$(darwin_CFLAGS)
|
darwin_CXXFLAGS=$(darwin_CFLAGS)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
||||||
from test_framework.test_framework import CryptoconditionsTestFramework
|
from test_framework.test_framework import CryptoconditionsTestFramework
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
from test_framework.util import assert_equal, assert_greater_than, \
|
from test_framework.util import assert_equal, assert_greater_than, \
|
||||||
@@ -11,13 +10,11 @@ from test_framework.util import assert_equal, assert_greater_than, \
|
|||||||
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises
|
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises
|
||||||
from cryptoconditions import assert_success, assert_error, generate_random_string
|
from cryptoconditions import assert_success, assert_error, generate_random_string
|
||||||
|
|
||||||
|
|
||||||
class CryptoconditionsOraclesTest(CryptoconditionsTestFramework):
|
class CryptoconditionsOraclesTest(CryptoconditionsTestFramework):
|
||||||
|
|
||||||
def run_oracles_tests(self):
|
def run_oracles_tests(self):
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
|
|
||||||
result = rpc1.oraclesaddress()
|
result = rpc1.oraclesaddress()
|
||||||
|
|
||||||
result = rpc.oraclesaddress()
|
result = rpc.oraclesaddress()
|
||||||
@@ -54,159 +51,197 @@ class CryptoconditionsOraclesTest(CryptoconditionsTestFramework):
|
|||||||
too_long_description = generate_random_string(4100)
|
too_long_description = generate_random_string(4100)
|
||||||
result = rpc.oraclescreate("Test", too_long_description, "s")
|
result = rpc.oraclescreate("Test", too_long_description, "s")
|
||||||
assert_error(result)
|
assert_error(result)
|
||||||
|
|
||||||
|
# need uxtos to create oracle? Crashes if without generate
|
||||||
|
rpc.generate(2)
|
||||||
|
|
||||||
# valid creating oracles of different types
|
# valid creating oracles of different types
|
||||||
# using such naming to re-use it for data publishing / reading (e.g. oracle_s for s type)
|
# using such naming to re-use it for data publishing / reading (e.g. oracle_s for s type)
|
||||||
|
|
||||||
valid_formats = ["s", "S", "d", "D", "c", "C", "t", "T", "i", "I", "l", "L", "h", "Ihh"]
|
valid_formats = ["s", "S", "d", "D", "c", "C", "t", "T", "i", "I", "l", "L", "h", "Ihh"]
|
||||||
for f in valid_formats:
|
for f in valid_formats:
|
||||||
result = rpc.oraclescreate("Test", "Test", f)
|
result = rpc.oraclescreate("Test_"+f, "Test_"+f, f)
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
globals()["oracle_{}".format(f)] = self.send_and_mine(result['hex'], rpc)
|
globals()["oracle_{}".format(f)] = self.send_and_mine(result['hex'], rpc)
|
||||||
|
|
||||||
# trying to register with negative datafee
|
# trying to register with negative datafee
|
||||||
for f in valid_formats:
|
|
||||||
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "-100")
|
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "-100")
|
||||||
assert_error(result)
|
assert_error(result)
|
||||||
|
|
||||||
# trying to register with zero datafee
|
# trying to register with zero datafee
|
||||||
for f in valid_formats:
|
|
||||||
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "0")
|
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "0")
|
||||||
assert_error(result)
|
assert_error(result)
|
||||||
|
|
||||||
# trying to register with datafee less than txfee
|
# trying to register with datafee less than txfee
|
||||||
for f in valid_formats:
|
|
||||||
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "500")
|
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "500")
|
||||||
assert_error(result)
|
assert_error(result)
|
||||||
|
|
||||||
# trying to register valid
|
# trying to register valid (unfunded)
|
||||||
for f in valid_formats:
|
|
||||||
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "10000")
|
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "10000")
|
||||||
|
assert_error(result)
|
||||||
|
|
||||||
|
# Fund the oracles
|
||||||
|
result = rpc.oraclesfund(globals()["oracle_{}".format(f)])
|
||||||
|
assert_success(result)
|
||||||
|
fund_txid = self.send_and_mine(result["hex"], rpc)
|
||||||
|
assert fund_txid, "got txid"
|
||||||
|
|
||||||
|
# trying to register valid (funded)
|
||||||
|
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "10000")
|
||||||
|
print(f)
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
register_txid = self.send_and_mine(result["hex"], rpc)
|
register_txid = self.send_and_mine(result["hex"], rpc)
|
||||||
assert register_txid, "got txid"
|
assert register_txid, "got txid"
|
||||||
|
|
||||||
# TODO: for most of the non valid oraclesregister and oraclessubscribe transactions generating and broadcasting now
|
# TODO: for most of the non valid oraclesregister and oraclessubscribe transactions generating and broadcasting now
|
||||||
# so trying only valid oraclessubscribe atm
|
# so trying only valid oraclessubscribe atm
|
||||||
for f in valid_formats:
|
|
||||||
result = rpc.oraclessubscribe(globals()["oracle_{}".format(f)], self.pubkey, "1")
|
result = rpc.oraclessubscribe(globals()["oracle_{}".format(f)], self.pubkey, "1")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
subscribe_txid = self.send_and_mine(result["hex"], rpc)
|
subscribe_txid = self.send_and_mine(result["hex"], rpc)
|
||||||
assert register_txid, "got txid"
|
assert register_txid, "got txid"
|
||||||
|
|
||||||
|
rpc.generate(1)
|
||||||
|
|
||||||
# now lets publish and read valid data for each oracle type
|
# now lets publish and read valid data for each oracle type
|
||||||
|
|
||||||
# s type
|
# s type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("s")], "05416e746f6e")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("s")], "05416e746f6e")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
|
||||||
oraclesdata_s = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_s = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("s")], oraclesdata_s, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("s")])
|
||||||
assert_equal("[u'Anton']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("s")], batonaddr, "1")
|
||||||
|
assert_equal("[u'Anton']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# S type
|
# S type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("S")], "000161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("S")], "000161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
|
||||||
oraclesdata_S = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_S = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("S")], oraclesdata_S, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("S")])
|
||||||
assert_equal("[u'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("S")], batonaddr, "1")
|
||||||
|
assert_equal("[u'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# d type
|
# d type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("d")], "0101")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("d")], "0101")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_d = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_d = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("d")], oraclesdata_d, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("d")])
|
||||||
assert_equal("[u'01']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("d")], batonaddr, "1")
|
||||||
|
assert_equal("[u'01']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# D type
|
# D type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("D")], "010001")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("D")], "010001")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_D = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_D = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("D")], oraclesdata_D, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("D")])
|
||||||
assert_equal("[u'01']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("D")], batonaddr, "1")
|
||||||
|
assert_equal("[u'01']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# c type
|
# c type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("c")], "ff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("c")], "ff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_c = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_c = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("c")], oraclesdata_c, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("c")])
|
||||||
assert_equal("[u'-1']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("c")], batonaddr, "1")
|
||||||
|
assert_equal("[u'-1']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# C type
|
# C type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("C")], "ff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("C")], "ff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_C = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_C = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("C")], oraclesdata_C, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("C")])
|
||||||
assert_equal("[u'255']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("C")], batonaddr, "1")
|
||||||
|
assert_equal("[u'255']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# t type
|
# t type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("t")], "ffff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("t")], "ffff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_t = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_t = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("t")], oraclesdata_t, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("t")])
|
||||||
assert_equal("[u'-1']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("t")], batonaddr, "1")
|
||||||
|
assert_equal("[u'-1']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# T type
|
# T type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("T")], "ffff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("T")], "ffff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_T = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_T = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("T")], oraclesdata_T, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("T")])
|
||||||
assert_equal("[u'65535']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("T")], batonaddr, "1")
|
||||||
|
assert_equal("[u'65535']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# i type
|
# i type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("i")], "ffffffff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("i")], "ffffffff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_i = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_i = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("i")], oraclesdata_i, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("i")])
|
||||||
assert_equal("[u'-1']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("i")], batonaddr, "1")
|
||||||
|
assert_equal("[u'-1']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# I type
|
# I type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("I")], "ffffffff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("I")], "ffffffff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_I = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_I = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("I")], oraclesdata_I, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("I")])
|
||||||
assert_equal("[u'4294967295']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("I")], batonaddr, "1")
|
||||||
|
assert_equal("[u'4294967295']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# l type
|
# l type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("l")], "00000000ffffffff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("l")], "00000000ffffffff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_l = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_l = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("l")], oraclesdata_l, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("l")])
|
||||||
# TODO: working not correct now!
|
batonaddr = info['registered'][0]['baton']
|
||||||
#assert_equal("[u'-4294967296']", str(result["samples"][0]), "Data match")
|
result = rpc.oraclessamples(globals()["oracle_{}".format("l")], batonaddr, "1")
|
||||||
|
assert_equal("[u'-4294967296']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# L type
|
# L type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("L")], "00000000ffffffff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("L")], "00000000ffffffff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_L = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_L = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("L")], oraclesdata_L, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("L")])
|
||||||
assert_equal("[u'18446744069414584320']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("L")], batonaddr, "1")
|
||||||
|
assert_equal("[u'18446744069414584320']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# h type
|
# h type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("h")], "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("h")], "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_h = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_h = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("h")], oraclesdata_h, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("h")])
|
||||||
assert_equal("[u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("h")], batonaddr, "1")
|
||||||
|
assert_equal("[u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
# Ihh type
|
# Ihh type
|
||||||
result = rpc.oraclesdata(globals()["oracle_{}".format("Ihh")], "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff")
|
result = rpc.oraclesdata(globals()["oracle_{}".format("Ihh")], "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff")
|
||||||
assert_success(result)
|
assert_success(result)
|
||||||
# baton
|
# baton
|
||||||
oraclesdata_Ihh = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_Ihh = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("Ihh")], oraclesdata_Ihh, "1")
|
info = rpc.oraclesinfo(globals()["oracle_{}".format("Ihh")])
|
||||||
assert_equal("[u'4294967295', u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000', u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000']", str(result["samples"][0]), "Data match")
|
batonaddr = info['registered'][0]['baton']
|
||||||
|
result = rpc.oraclessamples(globals()["oracle_{}".format("Ihh")], batonaddr, "1")
|
||||||
|
print(result)
|
||||||
|
assert_equal("[u'4294967295', u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000', u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000']", str(result["samples"][0]['data']), "Data match")
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
print("Mining blocks...")
|
print("Mining blocks...")
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
|
|
||||||
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
|
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
|
||||||
std::string OracleCreate(int64_t txfee,std::string name,std::string description,std::string format);
|
std::string OracleCreate(int64_t txfee,std::string name,std::string description,std::string format);
|
||||||
|
std::string OracleFund(int64_t txfee,uint256 oracletxid);
|
||||||
std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee);
|
std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee);
|
||||||
std::string OracleSubscribe(int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount);
|
std::string OracleSubscribe(int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount);
|
||||||
std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> data);
|
std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> data);
|
||||||
|
|
||||||
// CCcustom
|
// CCcustom
|
||||||
UniValue OracleDataSamples(uint256 reforacletxid,uint256 batontxid,int32_t num);
|
UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num);
|
||||||
UniValue OracleInfo(uint256 origtxid);
|
UniValue OracleInfo(uint256 origtxid);
|
||||||
UniValue OraclesList();
|
UniValue OraclesList();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CC_DARWIN = g++-6
|
CC_DARWIN = g++-8
|
||||||
CC_WIN = x86_64-w64-mingw32-gcc-posix
|
CC_WIN = x86_64-w64-mingw32-gcc-posix
|
||||||
CFLAGS_DARWIN = -DBUILD_ROGUE -std=c++11 -arch x86_64 -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib
|
CFLAGS_DARWIN = -DBUILD_ROGUE -std=c++11 -arch x86_64 -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib
|
||||||
CFLAGS = -Wno-write-strings -DBUILD_ROGUE -std=c++11 -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared
|
CFLAGS = -Wno-write-strings -DBUILD_ROGUE -std=c++11 -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared
|
||||||
@@ -14,7 +14,7 @@ TARGET = librogue.so
|
|||||||
TARGET_DARWIN = librogue.dylib
|
TARGET_DARWIN = librogue.dylib
|
||||||
TARGET_WIN = librogue.dll
|
TARGET_WIN = librogue.dll
|
||||||
SOURCES = cclib.cpp
|
SOURCES = cclib.cpp
|
||||||
#HEADERS = $(shell echo ../cryptoconditions/include/*.h) -I/usr/local/Cellar/gcc\@6/6.4.0_2/include/c++/6.4.0/
|
#HEADERS = $(shell echo ../cryptoconditions/include/*.h) -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -309,8 +309,8 @@ char *uppercase_str(char *buf,char *str);
|
|||||||
char *lowercase_str(char *buf,char *str);
|
char *lowercase_str(char *buf,char *str);
|
||||||
int32_t strsearch(char *strs[],int32_t num,char *name);
|
int32_t strsearch(char *strs[],int32_t num,char *name);
|
||||||
int32_t OS_getline(int32_t waitflag,char *line,int32_t max,char *dispstr);
|
int32_t OS_getline(int32_t waitflag,char *line,int32_t max,char *dispstr);
|
||||||
int32_t sort64s(uint64_t *buf,uint32_t num,int32_t size);
|
void sort64s(uint64_t *buf,uint32_t num,int32_t size);
|
||||||
int32_t revsort64s(uint64_t *buf,uint32_t num,int32_t size);
|
void revsort64s(uint64_t *buf,uint32_t num,int32_t size);
|
||||||
int decode_base32(uint8_t *token,uint8_t *tokenstr,int32_t len);
|
int decode_base32(uint8_t *token,uint8_t *tokenstr,int32_t len);
|
||||||
int init_base32(char *tokenstr,uint8_t *token,int32_t len);
|
int init_base32(char *tokenstr,uint8_t *token,int32_t len);
|
||||||
char *OS_mvstr();
|
char *OS_mvstr();
|
||||||
|
|||||||
@@ -92,10 +92,11 @@
|
|||||||
vout.n-1: opreturn with oracletxid, prevbatontxid and data in proper format
|
vout.n-1: opreturn with oracletxid, prevbatontxid and data in proper format
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
extern int32_t komodo_currentheight();
|
||||||
|
#define PUBKEY_SPOOFING_FIX_ACTIVATION 1563148800
|
||||||
|
#define CC_MARKER_VALUE 10000
|
||||||
|
|
||||||
// start of consensus code
|
// start of consensus code
|
||||||
|
|
||||||
|
|
||||||
CScript EncodeOraclesCreateOpRet(uint8_t funcid,std::string name,std::string description,std::string format)
|
CScript EncodeOraclesCreateOpRet(uint8_t funcid,std::string name,std::string description,std::string format)
|
||||||
{
|
{
|
||||||
CScript opret; uint8_t evalcode = EVAL_ORACLES;
|
CScript opret; uint8_t evalcode = EVAL_ORACLES;
|
||||||
@@ -124,6 +125,7 @@ uint8_t DecodeOraclesCreateOpRet(const CScript &scriptPubKey,std::string &name,s
|
|||||||
CScript EncodeOraclesOpRet(uint8_t funcid,uint256 oracletxid,CPubKey pk,int64_t num)
|
CScript EncodeOraclesOpRet(uint8_t funcid,uint256 oracletxid,CPubKey pk,int64_t num)
|
||||||
{
|
{
|
||||||
CScript opret; uint8_t evalcode = EVAL_ORACLES;
|
CScript opret; uint8_t evalcode = EVAL_ORACLES;
|
||||||
|
|
||||||
opret << OP_RETURN << E_MARSHAL(ss << evalcode << funcid << oracletxid << pk << num);
|
opret << OP_RETURN << E_MARSHAL(ss << evalcode << funcid << oracletxid << pk << num);
|
||||||
return(opret);
|
return(opret);
|
||||||
}
|
}
|
||||||
@@ -131,11 +133,12 @@ CScript EncodeOraclesOpRet(uint8_t funcid,uint256 oracletxid,CPubKey pk,int64_t
|
|||||||
uint8_t DecodeOraclesOpRet(const CScript &scriptPubKey,uint256 &oracletxid,CPubKey &pk,int64_t &num)
|
uint8_t DecodeOraclesOpRet(const CScript &scriptPubKey,uint256 &oracletxid,CPubKey &pk,int64_t &num)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t> vopret; uint8_t *script,e,f;
|
std::vector<uint8_t> vopret; uint8_t *script,e,f;
|
||||||
|
|
||||||
GetOpReturnData(scriptPubKey,vopret);
|
GetOpReturnData(scriptPubKey,vopret);
|
||||||
script = (uint8_t *)vopret.data();
|
script = (uint8_t *)vopret.data();
|
||||||
if ( vopret.size() > 2 && script[0] == EVAL_ORACLES )
|
if ( vopret.size() > 2 && script[0] == EVAL_ORACLES )
|
||||||
{
|
{
|
||||||
if (script[0] == EVAL_ORACLES && (script[1]== 'R' || script[1] == 'S') && E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> oracletxid; ss >> pk; ss >> num)!=0)
|
if (script[0] == EVAL_ORACLES && (script[1]== 'R' || script[1] == 'S' || script[1] == 'F') && E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> oracletxid; ss >> pk; ss >> num)!=0)
|
||||||
return(f);
|
return(f);
|
||||||
else return(script[1]);
|
else return(script[1]);
|
||||||
}
|
}
|
||||||
@@ -633,9 +636,25 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio
|
|||||||
else return(true);
|
else return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t GetLatestTimestamp(int32_t height)
|
||||||
|
{
|
||||||
|
uint256 blockHash; CBlock block; CBlockIndex* pindex;
|
||||||
|
|
||||||
|
blockHash = chainActive[height]->GetBlockHash();
|
||||||
|
pindex = mapBlockIndex[blockHash];
|
||||||
|
if ( komodo_blockload(block,pindex) == 0 )
|
||||||
|
{
|
||||||
|
return(block.nTime);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn)
|
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn)
|
||||||
{
|
{
|
||||||
uint256 txid,oracletxid,batontxid; uint64_t txfee=10000; int32_t numvins,numvouts,preventCCvins,preventCCvouts; uint8_t *script; std::vector<uint8_t> vopret,data; CScript scriptPubKey; CPubKey publisher;
|
uint256 oracletxid,batontxid; uint64_t txfee=10000; int32_t numvins,numvouts,preventCCvins,preventCCvouts; int64_t amount; uint256 hashblock;
|
||||||
|
uint8_t *script; std::vector<uint8_t> vopret,data; CPubKey publisher,tmppk,oraclespk; char tmpaddress[64],vinaddress[64],oraclesaddr[64];
|
||||||
|
CTransaction tmptx; std::string name,desc,format;
|
||||||
|
|
||||||
numvins = tx.vin.size();
|
numvins = tx.vin.size();
|
||||||
numvouts = tx.vout.size();
|
numvouts = tx.vout.size();
|
||||||
preventCCvins = preventCCvouts = -1;
|
preventCCvins = preventCCvouts = -1;
|
||||||
@@ -643,10 +662,11 @@ bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
|
|||||||
return eval->Invalid("no vouts");
|
return eval->Invalid("no vouts");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
txid = tx.GetHash();
|
|
||||||
GetOpReturnData(tx.vout[numvouts-1].scriptPubKey,vopret);
|
GetOpReturnData(tx.vout[numvouts-1].scriptPubKey,vopret);
|
||||||
if ( vopret.size() > 2 )
|
if ( vopret.size() > 2 )
|
||||||
{
|
{
|
||||||
|
oraclespk=GetUnspendable(cp,0);
|
||||||
|
Getscriptaddress(oraclesaddr,CScript() << ParseHex(HexStr(oraclespk)) << OP_CHECKSIG);
|
||||||
script = (uint8_t *)vopret.data();
|
script = (uint8_t *)vopret.data();
|
||||||
switch ( script[1] )
|
switch ( script[1] )
|
||||||
{
|
{
|
||||||
@@ -657,13 +677,45 @@ bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
|
|||||||
// vout.n-1: opreturn with name and description and format for data
|
// vout.n-1: opreturn with name and description and format for data
|
||||||
return eval->Invalid("unexpected OraclesValidate for create");
|
return eval->Invalid("unexpected OraclesValidate for create");
|
||||||
break;
|
break;
|
||||||
case 'R': // register
|
case 'F': // fund (activation on Jul 15th 2019 00:00)
|
||||||
// vins.*: normal inputs
|
// vins.*: normal inputs
|
||||||
|
// vout.0: txfee to oracle CC address of users pubkey
|
||||||
|
// vout.1: change, if any
|
||||||
|
// vout.n-1: opreturn with createtxid, pubkey and amount
|
||||||
|
return eval->Invalid("unexpected OraclesValidate for create");
|
||||||
|
break;
|
||||||
|
case 'R': // register
|
||||||
|
// vin.0: normal inputs
|
||||||
|
// vin.n-1: CC input from pubkeys oracle CC addres - to prove that register came from pubkey that is registred (activation on Jul 15th 2019 00:00)
|
||||||
// vout.0: txfee tag to normal marker address
|
// vout.0: txfee tag to normal marker address
|
||||||
// vout.1: baton CC utxo
|
// vout.1: baton CC utxo
|
||||||
// vout.2: change, if any
|
// vout.2: marker from oraclesfund tx to normal pubkey address (activation on Jul 15th 2019 00:00)
|
||||||
|
// vout.n-2: change, if any
|
||||||
// vout.n-1: opreturn with createtxid, pubkey and price per data point
|
// vout.n-1: opreturn with createtxid, pubkey and price per data point
|
||||||
return eval->Invalid("unexpected OraclesValidate for register");
|
if (GetLatestTimestamp(eval->GetCurrentHeight())>PUBKEY_SPOOFING_FIX_ACTIVATION)
|
||||||
|
{
|
||||||
|
if ((numvouts=tx.vout.size()) < 1 || DecodeOraclesOpRet(tx.vout[numvouts-1].scriptPubKey,oracletxid,tmppk,amount)!='R')
|
||||||
|
return eval->Invalid("invalid oraclesregister OP_RETURN data!");
|
||||||
|
else if (myGetTransaction(oracletxid,tmptx,hashblock) == 0)
|
||||||
|
return eval->Invalid("invalid oraclescreate txid!");
|
||||||
|
else if ((numvouts=tmptx.vout.size()) < 1 || DecodeOraclesCreateOpRet(tmptx.vout[numvouts-1].scriptPubKey,name,desc,format)!='C')
|
||||||
|
return eval->Invalid("invalid oraclescreate OP_RETURN data!");
|
||||||
|
else if ( IsCCInput(tmptx.vin[0].scriptSig) != 0 )
|
||||||
|
return eval->Invalid("vin.0 is normal for oraclescreate!");
|
||||||
|
else if (ConstrainVout(tmptx.vout[0],0,oraclesaddr,txfee)==0)
|
||||||
|
return eval->Invalid("invalid marker for oraclescreate!");
|
||||||
|
else if ( IsCCInput(tx.vin[0].scriptSig) != 0 )
|
||||||
|
return eval->Invalid("vin.0 is normal for oraclesregister!");
|
||||||
|
else if ((*cp->ismyvin)(tx.vin[tx.vin.size()-1].scriptSig) == 0 || myGetTransaction(tx.vin[tx.vin.size()-1].prevout.hash,tmptx,hashblock)==0
|
||||||
|
|| tmptx.vout[tx.vin[tx.vin.size()-1].prevout.n].nValue!=CC_MARKER_VALUE || !Getscriptaddress(vinaddress,tmptx.vout[tx.vin[tx.vin.size()-1].prevout.n].scriptPubKey)
|
||||||
|
|| !GetCCaddress(cp,tmpaddress,tmppk) || strcmp(tmpaddress,vinaddress)!=0)
|
||||||
|
return eval->Invalid("vin."+std::to_string(tx.vin.size()-1)+" is CC for oraclesregister or pubkey not same as vin pubkey, register must be done from owner of pubkey that registers to oracle!!");
|
||||||
|
else if (CCtxidaddr(tmpaddress,oracletxid).IsValid() && ConstrainVout(tx.vout[0],0,tmpaddress,txfee)==0)
|
||||||
|
return eval->Invalid("invalid marker for oraclesregister!");
|
||||||
|
else if (!Getscriptaddress(tmpaddress,CScript() << ParseHex(HexStr(tmppk)) << OP_CHECKSIG) || ConstrainVout(tx.vout[2],0,tmpaddress,CC_MARKER_VALUE)==0)
|
||||||
|
return eval->Invalid("pubkey in OP_RETURN and in vout.2 not matching, register must be done from owner of pubkey that registers to oracle!");
|
||||||
|
}
|
||||||
|
else return eval->Invalid("unexpected OraclesValidate for register");
|
||||||
break;
|
break;
|
||||||
case 'S': // subscribe
|
case 'S': // subscribe
|
||||||
// vins.*: normal inputs
|
// vins.*: normal inputs
|
||||||
@@ -762,6 +814,45 @@ int64_t LifetimeOraclesFunds(struct CCcontract_info *cp,uint256 oracletxid,CPubK
|
|||||||
return(total);
|
return(total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t AddMyOraclesFunds(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 oracletxid)
|
||||||
|
{
|
||||||
|
char coinaddr[64],funcid; int64_t nValue,tmpamount; uint256 tmporacletxid,txid,hashBlock,ignoretxid; int32_t numvouts,vout,ignorevin;
|
||||||
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; CTransaction vintx; CPubKey tmppk;
|
||||||
|
|
||||||
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
|
{
|
||||||
|
txid = it->first.txhash;
|
||||||
|
vout = (int32_t)it->first.index;
|
||||||
|
nValue = it->second.satoshis;
|
||||||
|
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 && (numvouts=vintx.vout.size())>0)
|
||||||
|
{
|
||||||
|
if ((funcid=DecodeOraclesOpRet(vintx.vout[numvouts-1].scriptPubKey,tmporacletxid,tmppk,tmpamount))!=0 && funcid=='F' && tmppk==pk
|
||||||
|
&& tmporacletxid==oracletxid && tmpamount==nValue && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout)==0)
|
||||||
|
{
|
||||||
|
mtx.vin.push_back(CTxIn(txid,vout,CScript()));
|
||||||
|
return (nValue);
|
||||||
|
}
|
||||||
|
} else fprintf(stderr,"couldnt find transaction\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_FOREACH(const CTxMemPoolEntry &e, mempool.mapTx)
|
||||||
|
{
|
||||||
|
const CTransaction &txmempool = e.GetTx();
|
||||||
|
const uint256 &hash = txmempool.GetHash();
|
||||||
|
nValue=txmempool.vout[0].nValue;
|
||||||
|
|
||||||
|
if ((funcid=DecodeOraclesOpRet(txmempool.vout[txmempool.vout.size()-1].scriptPubKey,tmporacletxid,tmppk,tmpamount))!=0 && funcid=='F'
|
||||||
|
&& tmppk==pk && tmporacletxid==oracletxid && tmpamount==nValue && myIsutxo_spentinmempool(ignoretxid,ignorevin,hash,0)==0)
|
||||||
|
{
|
||||||
|
mtx.vin.push_back(CTxIn(hash,0,CScript()));
|
||||||
|
return (nValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
std::string OracleCreate(int64_t txfee,std::string name,std::string description,std::string format)
|
std::string OracleCreate(int64_t txfee,std::string name,std::string description,std::string format)
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||||
@@ -802,10 +893,36 @@ std::string OracleCreate(int64_t txfee,std::string name,std::string description,
|
|||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string OracleFund(int64_t txfee,uint256 oracletxid)
|
||||||
|
{
|
||||||
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||||
|
CPubKey mypk,oraclespk; struct CCcontract_info *cp,C;
|
||||||
|
|
||||||
|
if (GetLatestTimestamp(komodo_currentheight())<PUBKEY_SPOOFING_FIX_ACTIVATION)
|
||||||
|
{
|
||||||
|
CCerror = strprintf("oraclesfund not active yet, activation scheduled for July 15th");
|
||||||
|
fprintf(stderr,"%s\n", CCerror.c_str() );
|
||||||
|
return("");
|
||||||
|
}
|
||||||
|
cp = CCinit(&C,EVAL_ORACLES);
|
||||||
|
if ( txfee == 0 )
|
||||||
|
txfee = 10000;
|
||||||
|
mypk = pubkey2pk(Mypubkey());
|
||||||
|
if (AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,2))
|
||||||
|
{
|
||||||
|
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CC_MARKER_VALUE,mypk));
|
||||||
|
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('F',oracletxid,mypk,CC_MARKER_VALUE)));
|
||||||
|
}
|
||||||
|
CCerror = strprintf("error adding normal inputs");
|
||||||
|
fprintf(stderr,"%s\n", CCerror.c_str() );
|
||||||
|
return("");
|
||||||
|
}
|
||||||
|
|
||||||
std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee)
|
std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee)
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||||
CPubKey mypk,markerpubkey,batonpk; struct CCcontract_info *cp,C; char markeraddr[64],batonaddr[64];
|
CPubKey mypk,markerpubkey,batonpk,oraclespk; struct CCcontract_info *cp,C; char markeraddr[64],batonaddr[64];
|
||||||
|
|
||||||
cp = CCinit(&C,EVAL_ORACLES);
|
cp = CCinit(&C,EVAL_ORACLES);
|
||||||
if ( txfee == 0 )
|
if ( txfee == 0 )
|
||||||
txfee = 10000;
|
txfee = 10000;
|
||||||
@@ -816,12 +933,20 @@ std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee)
|
|||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
|
oraclespk = GetUnspendable(cp,0);
|
||||||
batonpk = OracleBatonPk(batonaddr,cp);
|
batonpk = OracleBatonPk(batonaddr,cp);
|
||||||
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
|
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
|
||||||
if ( AddNormalinputs(mtx,mypk,3*txfee,4) > 0 )
|
if (AddNormalinputs(mtx,mypk,3*txfee,4))
|
||||||
{
|
{
|
||||||
|
if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
|
||||||
|
{
|
||||||
|
CCerror = strprintf("error adding inputs from your Oracles CC address, please fund it first with oraclesfund rpc!");
|
||||||
|
fprintf(stderr,"%s\n", CCerror.c_str() );
|
||||||
|
return("");
|
||||||
|
}
|
||||||
mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG));
|
mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG));
|
||||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
|
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
|
||||||
|
if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION) mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
||||||
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('R',oracletxid,mypk,datafee)));
|
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('R',oracletxid,mypk,datafee)));
|
||||||
}
|
}
|
||||||
CCerror = strprintf("error adding normal inputs");
|
CCerror = strprintf("error adding normal inputs");
|
||||||
@@ -924,43 +1049,70 @@ std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> da
|
|||||||
|
|
||||||
UniValue OracleFormat(uint8_t *data,int32_t datalen,char *format,int32_t formatlen)
|
UniValue OracleFormat(uint8_t *data,int32_t datalen,char *format,int32_t formatlen)
|
||||||
{
|
{
|
||||||
uint256 hash; int32_t i,j=0; int64_t val; char str[IGUANA_MAXSCRIPTSIZE*2+1];
|
UniValue obj(UniValue::VARR); uint256 hash; int32_t i,j=0; int64_t val; char str[IGUANA_MAXSCRIPTSIZE*2+1];
|
||||||
for (i=0; i<formatlen && j<datalen; i++)
|
for (i=0; i<formatlen && j<datalen; i++)
|
||||||
{
|
{
|
||||||
str[0] = 0;
|
str[0] = 0;
|
||||||
j = oracle_format(&hash,&val,str,format[i],data,j,datalen);
|
j = oracle_format(&hash,&val,str,format[i],data,j,datalen);
|
||||||
|
obj.push_back(str);
|
||||||
if ( j < 0 )
|
if ( j < 0 )
|
||||||
break;
|
break;
|
||||||
if ( j >= datalen )
|
if ( j >= datalen )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return(str);
|
return(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue OracleDataSamples(uint256 reforacletxid,uint256 batontxid,int32_t num)
|
UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
|
||||||
{
|
{
|
||||||
UniValue result(UniValue::VOBJ),b(UniValue::VARR); CTransaction tx,oracletx; uint256 hashBlock,btxid,oracletxid;
|
UniValue result(UniValue::VOBJ),b(UniValue::VARR); CTransaction tx,oracletx; uint256 txid,hashBlock,btxid,oracletxid;
|
||||||
CPubKey pk; std::string name,description,format; int32_t numvouts,n=0; std::vector<uint8_t> data; char str[67], *formatstr = 0;
|
CPubKey pk; std::string name,description,format; int32_t numvouts,n=0,vout; std::vector<uint8_t> data; char *formatstr = 0;
|
||||||
|
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; int64_t nValue;
|
||||||
|
|
||||||
result.push_back(Pair("result","success"));
|
result.push_back(Pair("result","success"));
|
||||||
if ( GetTransaction(reforacletxid,oracletx,hashBlock,false) != 0 && (numvouts=oracletx.vout.size()) > 0 )
|
if ( GetTransaction(reforacletxid,oracletx,hashBlock,false) != 0 && (numvouts=oracletx.vout.size()) > 0 )
|
||||||
{
|
{
|
||||||
if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' )
|
if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' )
|
||||||
{
|
{
|
||||||
while ( GetTransaction(batontxid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 )
|
BOOST_FOREACH(const CTxMemPoolEntry &e, mempool.mapTx)
|
||||||
{
|
{
|
||||||
if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
|
const CTransaction &txmempool = e.GetTx();
|
||||||
|
const uint256 &hash = txmempool.GetHash();
|
||||||
|
if ((numvouts=txmempool.vout.size())>0 && DecodeOraclesData(txmempool.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
|
||||||
{
|
{
|
||||||
if ( (formatstr= (char *)format.c_str()) == 0 )
|
if ( (formatstr= (char *)format.c_str()) == 0 )
|
||||||
formatstr = (char *)"";
|
formatstr = (char *)"";
|
||||||
UniValue a(UniValue::VOBJ);
|
UniValue a(UniValue::VOBJ);
|
||||||
|
a.push_back(Pair("txid",hash.GetHex()));
|
||||||
a.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size())));
|
a.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size())));
|
||||||
a.push_back(Pair("txid",uint256_str(str,batontxid)));
|
|
||||||
b.push_back(a);
|
b.push_back(a);
|
||||||
batontxid = btxid;
|
|
||||||
if ( ++n >= num && num != 0)
|
if ( ++n >= num && num != 0)
|
||||||
break;
|
break;
|
||||||
} else break;
|
}
|
||||||
|
}
|
||||||
|
SetCCtxids(addressIndex,batonaddr,true);
|
||||||
|
if (addressIndex.size()>0)
|
||||||
|
{
|
||||||
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.end()-1; it!=addressIndex.begin(); it--)
|
||||||
|
{
|
||||||
|
txid=it->first.txhash;
|
||||||
|
vout = (int32_t)it->first.index;
|
||||||
|
nValue = (int64_t)it->second;
|
||||||
|
if (vout==1 && nValue==10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 )
|
||||||
|
{
|
||||||
|
if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
|
||||||
|
{
|
||||||
|
if ( (formatstr= (char *)format.c_str()) == 0 )
|
||||||
|
formatstr = (char *)"";
|
||||||
|
UniValue a(UniValue::VOBJ);
|
||||||
|
a.push_back(Pair("txid",txid.GetHex()));
|
||||||
|
a.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size())));
|
||||||
|
b.push_back(a);
|
||||||
|
if ( ++n >= num && num != 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -971,10 +1123,12 @@ UniValue OracleDataSamples(uint256 reforacletxid,uint256 batontxid,int32_t num)
|
|||||||
UniValue OracleInfo(uint256 origtxid)
|
UniValue OracleInfo(uint256 origtxid)
|
||||||
{
|
{
|
||||||
UniValue result(UniValue::VOBJ),a(UniValue::VARR);
|
UniValue result(UniValue::VOBJ),a(UniValue::VARR);
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; int32_t height;
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||||
CTransaction regtx,tx; std::string name,description,format; uint256 hashBlock,txid,oracletxid,batontxid; CPubKey pk;
|
CTransaction tx; std::string name,description,format; uint256 hashBlock,txid,oracletxid,batontxid; CPubKey pk;
|
||||||
struct CCcontract_info *cp,C; int64_t datafee,funding; char str[67],markeraddr[64],numstr[64],batonaddr[64]; std::vector <uint8_t> data;
|
struct CCcontract_info *cp,C; int64_t datafee,funding; char str[67],markeraddr[64],numstr[64],batonaddr[64]; std::vector <uint8_t> data;
|
||||||
|
std::map<CPubKey,std::pair<uint256,int32_t>> publishers;
|
||||||
|
|
||||||
cp = CCinit(&C,EVAL_ORACLES);
|
cp = CCinit(&C,EVAL_ORACLES);
|
||||||
CCtxidaddr(markeraddr,origtxid);
|
CCtxidaddr(markeraddr,origtxid);
|
||||||
if ( GetTransaction(origtxid,tx,hashBlock,false) == 0 )
|
if ( GetTransaction(origtxid,tx,hashBlock,false) == 0 )
|
||||||
@@ -998,28 +1152,38 @@ UniValue OracleInfo(uint256 origtxid)
|
|||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
if ( GetTransaction(txid,regtx,hashBlock,false) != 0 )
|
height = (int32_t)it->second.blockHeight;
|
||||||
|
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 &&
|
||||||
|
DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R' && oracletxid == origtxid )
|
||||||
{
|
{
|
||||||
if ( regtx.vout.size() > 0 && DecodeOraclesOpRet(regtx.vout[regtx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R' && oracletxid == origtxid )
|
if (publishers.find(pk)==publishers.end() || height>publishers[pk].second)
|
||||||
{
|
{
|
||||||
UniValue obj(UniValue::VOBJ);
|
publishers[pk].first=txid;
|
||||||
obj.push_back(Pair("publisher",pubkey33_str(str,(uint8_t *)pk.begin())));
|
publishers[pk].second=height;
|
||||||
Getscriptaddress(batonaddr,regtx.vout[1].scriptPubKey);
|
|
||||||
batontxid = OracleBatonUtxo(10000,cp,oracletxid,batonaddr,pk,data);
|
|
||||||
obj.push_back(Pair("baton",batonaddr));
|
|
||||||
obj.push_back(Pair("batontxid",uint256_str(str,batontxid)));
|
|
||||||
funding = LifetimeOraclesFunds(cp,oracletxid,pk);
|
|
||||||
sprintf(numstr,"%.8f",(double)funding/COIN);
|
|
||||||
obj.push_back(Pair("lifetime",numstr));
|
|
||||||
funding = AddOracleInputs(cp,mtx,oracletxid,pk,0,0);
|
|
||||||
sprintf(numstr,"%.8f",(double)funding/COIN);
|
|
||||||
obj.push_back(Pair("funds",numstr));
|
|
||||||
sprintf(numstr,"%.8f",(double)datafee/COIN);
|
|
||||||
obj.push_back(Pair("datafee",numstr));
|
|
||||||
a.push_back(obj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (std::map<CPubKey,std::pair<uint256,int32_t>>::iterator it = publishers.begin(); it != publishers.end(); ++it)
|
||||||
|
{
|
||||||
|
if ( GetTransaction(it->second.first,tx,hashBlock,false) != 0 && DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R')
|
||||||
|
{
|
||||||
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
obj.push_back(Pair("publisher",pubkey33_str(str,(uint8_t *)pk.begin())));
|
||||||
|
Getscriptaddress(batonaddr,tx.vout[1].scriptPubKey);
|
||||||
|
batontxid = OracleBatonUtxo(10000,cp,oracletxid,batonaddr,pk,data);
|
||||||
|
obj.push_back(Pair("baton",batonaddr));
|
||||||
|
obj.push_back(Pair("batontxid",uint256_str(str,batontxid)));
|
||||||
|
funding = LifetimeOraclesFunds(cp,oracletxid,pk);
|
||||||
|
sprintf(numstr,"%.8f",(double)funding/COIN);
|
||||||
|
obj.push_back(Pair("lifetime",numstr));
|
||||||
|
funding = AddOracleInputs(cp,mtx,oracletxid,pk,0,0);
|
||||||
|
sprintf(numstr,"%.8f",(double)funding/COIN);
|
||||||
|
obj.push_back(Pair("funds",numstr));
|
||||||
|
sprintf(numstr,"%.8f",(double)datafee/COIN);
|
||||||
|
obj.push_back(Pair("datafee",numstr));
|
||||||
|
a.push_back(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
result.push_back(Pair("registered",a));
|
result.push_back(Pair("registered",a));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
21
src/komodo.h
21
src/komodo.h
@@ -803,7 +803,10 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// int32_t !
|
// int32_t (!!!)
|
||||||
|
/*
|
||||||
|
read blackjok3rtt comments in main.cpp
|
||||||
|
*/
|
||||||
int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
||||||
{
|
{
|
||||||
static int32_t hwmheight;
|
static int32_t hwmheight;
|
||||||
@@ -897,8 +900,8 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
}
|
}
|
||||||
numvalid = bitweight(signedmask);
|
numvalid = bitweight(signedmask);
|
||||||
if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) ||
|
if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) ||
|
||||||
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
|
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
|
||||||
numvalid > (numnotaries/5) )
|
numvalid > (numnotaries/5) )
|
||||||
{
|
{
|
||||||
if ( !fJustCheck && ASSETCHAINS_SYMBOL[0] != 0)
|
if ( !fJustCheck && ASSETCHAINS_SYMBOL[0] != 0)
|
||||||
{
|
{
|
||||||
@@ -918,7 +921,7 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
fflush(signedfp);
|
fflush(signedfp);
|
||||||
}
|
}
|
||||||
transaction = i;
|
transaction = i;
|
||||||
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
|
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
|
||||||
}
|
}
|
||||||
notarized = 1;
|
notarized = 1;
|
||||||
}
|
}
|
||||||
@@ -1014,7 +1017,9 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
|
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
|
||||||
if ( !fJustCheck && pindex->GetHeight() == hwmheight )
|
if ( !fJustCheck && pindex->GetHeight() == hwmheight )
|
||||||
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0,zero,0);
|
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0,zero,0);
|
||||||
} else fprintf(stderr,"komodo_connectblock: unexpected null pindex\n");
|
}
|
||||||
|
else
|
||||||
|
{ fprintf(stderr,"komodo_connectblock: unexpected null pindex\n"); return(0); }
|
||||||
//KOMODO_INITDONE = (uint32_t)time(NULL);
|
//KOMODO_INITDONE = (uint32_t)time(NULL);
|
||||||
//fprintf(stderr,"%s end connect.%d\n",ASSETCHAINS_SYMBOL,pindex->GetHeight());
|
//fprintf(stderr,"%s end connect.%d\n",ASSETCHAINS_SYMBOL,pindex->GetHeight());
|
||||||
if (fJustCheck)
|
if (fJustCheck)
|
||||||
@@ -1025,6 +1030,12 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
return(1);
|
return(1);
|
||||||
if ( notarisations.size() > 1 || (notarisations.size() == 1 && notarisations[0] != 1) )
|
if ( notarisations.size() > 1 || (notarisations.size() == 1 && notarisations[0] != 1) )
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
|
fprintf(stderr,"komodo_connectblock: unxexpected behaviour when fJustCheck == true, report blackjok3rtt plz ! \n");
|
||||||
|
/* this needed by gcc-8, it counts here that control reaches end of non-void function without this.
|
||||||
|
by default, we count that if control reached here -> the valid notarization isnt in position 1 or there are too many notarizations in this block.
|
||||||
|
*/
|
||||||
|
return(-1);
|
||||||
}
|
}
|
||||||
else return(0);
|
else return(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,70 @@ static const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] =
|
|||||||
{"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" },
|
{"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }
|
{"madmax_NA", "02016371f90f195ed9aeaf37be06f3fbbfbfe2ef8a4fd66378378289476e7751db" },
|
||||||
|
{"alright_AR", "020566fe2fb3874258b2d3cf1809a5d650e0edc7ba746fa5eec72750c5188c9cc9" },
|
||||||
|
{"strob_NA", "0206f7a2e972d9dfef1c424c731503a0a27de1ba7a15a91a362dc7ec0d0fb47685" },
|
||||||
|
{"dwy_EU", "020a77f454a1d3fcdc0312048fc58d713fe6153189e0c59cdd12fedbf09553d4b0" },
|
||||||
|
{"phm87_SH", "021773a38db1bc3ede7f28142f901a161c7b7737875edbb40082a201c55dcf0add" },
|
||||||
|
{"chainmakers_NA", "021ad488cc063e17d0f1a2aade6be65ef8b5ff879987cb0b86bb700733099fe524" },
|
||||||
|
{"indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" },
|
||||||
|
{"blackjok3r_SH", "0226293d7644e1380555ecc2d385ba038a66f4202b24b643ab31bcad0dc1474de2" },
|
||||||
|
{"chainmakers_EU", "022a6b583e8820d14d911a11820fd80853c5b8406e91a0a6fcac1f133d098d75cb" },
|
||||||
|
{"titomane_AR", "023e3aa9834c46971ff3e7cb86a200ec9c8074a9566a3ea85d400d5739662ee989" },
|
||||||
|
{"fullmoon_SH", "02639998420688ee935d279d1cd52f1c6f3ae12c1f3afc20b3bf7ece1057f8b93b" }, // 10
|
||||||
|
{"indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" },
|
||||||
|
{"chmex_EU", "0281304ebbcc39e4f09fda85f4232dd8dacd668e20e5fc11fba6b985186c90086e" },
|
||||||
|
{"metaphilibert_SH", "0284af1a5ef01503e6316a2ca4abf8423a794e9fc17ac6846f042b6f4adedc3309" },
|
||||||
|
{"ca333_DEV", "02856843af2d9457b5b1c907068bef6077ea0904cc8bd4df1ced013f64bf267958" },
|
||||||
|
{"cipi_NA", "02858904a2a1a0b44df4c937b65ee1f5b66186ab87a751858cf270dee1d5031f18" },
|
||||||
|
{"pungocloud_SH", "02863628f842a8aa424daf745cf43a1717cfcd571338ba87bfcec4d340703d01d6" },
|
||||||
|
{"voskcoin_EU", "028cfb0bbce2207425bc8d40fff634269bb61aade2d1d03883398275550b465600" },
|
||||||
|
{"decker_DEV", "028eea44a09674dda00d88ffd199a09c9b75ba9782382cc8f1e97c0fd565fe5707" },
|
||||||
|
{"cryptoeconomy_EU", "0290ab4937e85246e048552df3e9a66cba2c1602db76e03763e16c671e750145d1" },
|
||||||
|
{"etszombi_EU", "0293ea48d8841af7a419a24d9da11c34b39127ef041f847651bae6ab14dcd1f6b4" }, // 20
|
||||||
|
{"karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" },
|
||||||
|
{"pirate_AR", "02a5e865af771eee0c6bd3bd238f01f5eb589907ba52efa9f37e5102375c8eb7a0" },
|
||||||
|
{"metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" },
|
||||||
|
{"zatjum_SH", "02b315714f99fdd70bafd50a4c3aa4b9db0fd8d63978bd8d47763773400b28734c" },
|
||||||
|
{"madmax_AR", "02b37913ac0250d17cca5bb94ef65928b1515f13f839075446db73b9b067c13aa0" },
|
||||||
|
{"lukechilds_NA", "02c191a085bbb0bd86d126c62d3e801c503038b69c0c2de121c9a7abe3e6684420" },
|
||||||
|
{"cipi_AR", "02c4f89a5b382750836cb787880d30e23502265054e1c327a5bfce67116d757ce8" },
|
||||||
|
{"tonyl_AR", "02cc8bc862f2b65ad4f99d5f68d3011c138bf517acdc8d4261166b0be8f64189e1" },
|
||||||
|
{"infotech_DEV", "02d7d63ac441dbcd5535bcad741701519c190e89e17e4180aa0f61fdda0b6195ea" },
|
||||||
|
{"fullmoon_NA", "02da228a67e519b21bca6426ed982509a21d24d45f1ac1bdf698b6083fed442ec3" }, // 30
|
||||||
|
{"etszombi_AR", "02e55e104aa94f70cde68165d7df3e162d4410c76afd4643b161dea044aa6d06ce" },
|
||||||
|
{"node-9_EU", "02e90f0528f8fd7d2b7f28d53ed7368cc4b1dfc5814c70c486c533862ee05e37dc" },
|
||||||
|
{"phba2061_EU", "02eaa599f5434039adc5748b3b830f605342e11b51273046b04f24acc5bcecc74a" },
|
||||||
|
{"indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" },
|
||||||
|
{"and1-89_EU", "02f2af778c62888cfb106c0ef5c89cefe012ef3e6abed3ef28425092637d7ae3cc" },
|
||||||
|
{"komodopioneers_SH", "02ffde73d51b56bf9e23b6f03008ac7916cacd3be090f44eab59877792e08b6751" },
|
||||||
|
{"komodopioneers_EU", "03014f3fceb9f851f9dba5f5b371c7758b3f1fe44a70b4e60e3d6c70d1e5265358" },
|
||||||
|
{"d0ct0r_NA", "0303725d8525b6f969122faf04152653eb4bf34e10de92182263321769c334bf58" },
|
||||||
|
{"kolo_DEV", "030f34af4b908fb8eb2099accb56b8d157d49f6cfb691baa80fdd34f385efed961" },
|
||||||
|
{"peer2cloud_AR", "030fe3c77db0f91d79c26f951b674bba557b899f16570cd75332829a07031b0097" }, // 40
|
||||||
|
{"webworker01_SH", "031e50ba6de3c16f99d414bb89866e578d963a54bde7916c810608966fb5700776" },
|
||||||
|
{"webworker01_NA", "032735e9cad1bb00eaababfa6d27864fa4c1db0300c85e01e52176be2ca6a243ce" },
|
||||||
|
{"pbca26_NA", "0331c51abb78a9891d1b9483747a7fd9bbbbdd5256f40af23c87384e3d9a974289" },
|
||||||
|
{"indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" },
|
||||||
|
{"pirate_NA", "033c8cef71f704f357c9ac1aeaafde3acd7bbfd0a09494e5e129ee0999fb2bc368" },
|
||||||
|
{"lukechilds_AR", "035004d780316008c8afd5ac28d08aae56f4746bf70eb2c999e3c7d9a7a50ca8b6" },
|
||||||
|
{"dragonhound_NA", "0354c779b9b111fdc825ee0250b33a79a837e0775a111a89916853d02a8999285c" },
|
||||||
|
{"fullmoon_AR", "035673e913d603137f7f517d88bf316e51d408e0ec2b2cdcbfbdd5c0b553fc9351" },
|
||||||
|
{"chainzilla_SH", "0360804b8817fd25ded6e9c0b50e3b0782ac666545b5416644198e18bc3903d9f9" },
|
||||||
|
{"titomane_EU", "03772ac0aad6b0e9feec5e591bff5de6775d6132e888633e73d3ba896bdd8e0afb" }, // 50
|
||||||
|
{"jeezy_EU", "037f182facbad35684a6e960699f5da4ba89e99f0d0d62a87e8400dd086c8e5dd7" },
|
||||||
|
{"titomane_SH", "03850fdddf2413b51790daf51dd30823addb37313c8854b508ea6228205047ef9b" },
|
||||||
|
{"alien_AR", "03911a60395801082194b6834244fa78a3c30ff3e888667498e157b4aa80b0a65f" },
|
||||||
|
{"pirate_EU", "03986339bebe3891e369a528356a220bc17a5bef3d337edfcf0114e66e6b1c120f" },
|
||||||
|
{"thegaltmines_NA", "03b113c7aa1042c965154bf791713f562891ac75e60ab78886205535bcaabb5013" },
|
||||||
|
{"computergenie_NA", "03b41c764c8cd63b48b79f15f112a9b5105a0dce35df7d6990d6919503a1f3f245" },
|
||||||
|
{"nutellalicka_SH", "03b422ec85a8465ae42e7004bc6d0856a458f0f920ec0f58fd4d5613994f3faa5b" },
|
||||||
|
{"chainstrike_SH", "03b806be3bf7a1f2f6290ec5c1ea7d3ea57774dcfcf2129a82b2569e585100e1cb" },
|
||||||
|
{"dwy_SH", "03b9162f9713d7cddd89aaad0398b67f66377cc17547ec0643a67c2d6fb099ecf0" }, // 60
|
||||||
|
{"alien_EU", "03bb749e337b9074465fa28e757b5aa92cb1f0fea1a39589bca91a602834d443cd" },
|
||||||
|
{"gt_AR", "03e22a6aad65c9a4c2ce2e724b26edf631b5f41253449dd5feaeba68e7c0cf3058" },
|
||||||
|
{"patchkez_SH", "03f45e9beb5c4cd46525db8195eb05c1db84ae7ef3603566b3d775770eba3b96ee" },
|
||||||
|
{"decker_AR", "03ffdf1a116300a78729608d9930742cd349f11a9d64fcc336b8f18592dd9c91bc" },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -241,6 +304,7 @@ extern int32_t ASSETCHAINS_EARLYTXIDCONTRACT;
|
|||||||
int tx_height( const uint256 &hash );
|
int tx_height( const uint256 &hash );
|
||||||
extern std::vector<std::string> vWhiteListAddress;
|
extern std::vector<std::string> vWhiteListAddress;
|
||||||
void komodo_netevent(std::vector<uint8_t> payload);
|
void komodo_netevent(std::vector<uint8_t> payload);
|
||||||
|
int32_t getacseason(uint32_t timestamp);
|
||||||
|
|
||||||
#define IGUANA_MAXSCRIPTSIZE 10001
|
#define IGUANA_MAXSCRIPTSIZE 10001
|
||||||
#define KOMODO_KVDURATION 1440
|
#define KOMODO_KVDURATION 1440
|
||||||
|
|||||||
@@ -2597,7 +2597,7 @@ static int cmp_llu(const void *a, const void*b)
|
|||||||
else return(1);
|
else return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t sort64(int64_t *l, int32_t llen)
|
static void sort64(int64_t *l, int32_t llen)
|
||||||
{
|
{
|
||||||
qsort(l,llen,sizeof(uint64_t),cmp_llu);
|
qsort(l,llen,sizeof(uint64_t),cmp_llu);
|
||||||
}
|
}
|
||||||
@@ -2611,7 +2611,7 @@ static int revcmp_llu(const void *a, const void*b)
|
|||||||
else return(1);
|
else return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t revsort64(int64_t *l, int32_t llen)
|
static void revsort64(int64_t *l, int32_t llen)
|
||||||
{
|
{
|
||||||
qsort(l,llen,sizeof(uint64_t),revcmp_llu);
|
qsort(l,llen,sizeof(uint64_t),revcmp_llu);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1665,7 +1665,6 @@ uint64_t komodo_ac_block_subsidy(int nHeight)
|
|||||||
|
|
||||||
extern int64_t MAX_MONEY;
|
extern int64_t MAX_MONEY;
|
||||||
void komodo_cbopretupdate(int32_t forceflag);
|
void komodo_cbopretupdate(int32_t forceflag);
|
||||||
int32_t getacseason(int32_t timestamp);
|
|
||||||
void SplitStr(const std::string& strVal, std::vector<std::string> &outVals);
|
void SplitStr(const std::string& strVal, std::vector<std::string> &outVals);
|
||||||
|
|
||||||
int8_t equihash_params_possible(uint64_t n, uint64_t k)
|
int8_t equihash_params_possible(uint64_t n, uint64_t k)
|
||||||
|
|||||||
@@ -1373,8 +1373,6 @@ bool CheckTransaction(uint32_t tiptime,const CTransaction& tx, CValidationState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int32_t getacseason(int32_t timestamp);
|
|
||||||
|
|
||||||
int32_t komodo_isnotaryvout(char *coinaddr,uint32_t tiptime) // from ac_private chains only
|
int32_t komodo_isnotaryvout(char *coinaddr,uint32_t tiptime) // from ac_private chains only
|
||||||
{
|
{
|
||||||
int32_t season = getacseason(tiptime);
|
int32_t season = getacseason(tiptime);
|
||||||
@@ -3392,7 +3390,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
{
|
{
|
||||||
// do a full block scan to get notarisation position and to enforce a valid notarization is in position 1.
|
// do a full block scan to get notarisation position and to enforce a valid notarization is in position 1.
|
||||||
// if notarisation in the block, must be position 1 and the coinbase must pay notaries.
|
// if notarisation in the block, must be position 1 and the coinbase must pay notaries.
|
||||||
int notarisationTx = komodo_connectblock(true,pindex,*(CBlock *)&block);
|
int32_t notarisationTx = komodo_connectblock(true,pindex,*(CBlock *)&block);
|
||||||
// -1 means that the valid notarization isnt in position 1 or there are too many notarizations in this block.
|
// -1 means that the valid notarization isnt in position 1 or there are too many notarizations in this block.
|
||||||
if ( notarisationTx == -1 )
|
if ( notarisationTx == -1 )
|
||||||
return state.DoS(100, error("ConnectBlock(): Notarization is not in TX position 1 or block contains more than 1 notarization! Invalid Block!"),
|
return state.DoS(100, error("ConnectBlock(): Notarization is not in TX position 1 or block contains more than 1 notarization! Invalid Block!"),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2010 Satoshi Nakamoto
|
// Copyright (c) 2010 Satoshi Nakamoto
|
||||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||||
|
// Copyright (c) 2019 The Hush developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
|
|
||||||
using namespace RPCServer;
|
using namespace RPCServer;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
|
||||||
|
|
||||||
static bool fRPCRunning = false;
|
static bool fRPCRunning = false;
|
||||||
static bool fRPCInWarmup = true;
|
static bool fRPCInWarmup = true;
|
||||||
@@ -454,6 +456,7 @@ static const CRPCCommand vRPCCommands[] =
|
|||||||
{ "oracles", "oracleslist", &oracleslist, true },
|
{ "oracles", "oracleslist", &oracleslist, true },
|
||||||
{ "oracles", "oraclesinfo", &oraclesinfo, true },
|
{ "oracles", "oraclesinfo", &oraclesinfo, true },
|
||||||
{ "oracles", "oraclescreate", &oraclescreate, true },
|
{ "oracles", "oraclescreate", &oraclescreate, true },
|
||||||
|
{ "oracles", "oraclesfund", &oraclesfund, true },
|
||||||
{ "oracles", "oraclesregister", &oraclesregister, true },
|
{ "oracles", "oraclesregister", &oraclesregister, true },
|
||||||
{ "oracles", "oraclessubscribe", &oraclessubscribe, true },
|
{ "oracles", "oraclessubscribe", &oraclessubscribe, true },
|
||||||
{ "oracles", "oraclesdata", &oraclesdata, true },
|
{ "oracles", "oraclesdata", &oraclesdata, true },
|
||||||
@@ -853,21 +856,30 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms
|
|||||||
|
|
||||||
std::string HelpExampleCli(const std::string& methodname, const std::string& args)
|
std::string HelpExampleCli(const std::string& methodname, const std::string& args)
|
||||||
{
|
{
|
||||||
return "> komodo-cli " + methodname + " " + args + "\n";
|
if ( ASSETCHAINS_SYMBOL[0] == 0 ) {
|
||||||
|
return "> komodo-cli " + methodname + " " + args + "\n";
|
||||||
|
} else if ((strncmp(ASSETCHAINS_SYMBOL, "HUSH3", 5) == 0) ) {
|
||||||
|
return "> hush-cli " + methodname + " " + args + "\n";
|
||||||
|
} else {
|
||||||
|
return "> komodo-cli -ac_name=" + strprintf("%s", ASSETCHAINS_SYMBOL) + " " + methodname + " " + args + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string HelpExampleRpc(const std::string& methodname, const std::string& args)
|
std::string HelpExampleRpc(const std::string& methodname, const std::string& args)
|
||||||
{
|
{
|
||||||
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
|
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
|
||||||
"\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:7771/\n";
|
"\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:" + to_string(ASSETCHAINS_RPCPORT) + "/\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string experimentalDisabledHelpMsg(const string& rpc, const string& enableArg)
|
string experimentalDisabledHelpMsg(const string& rpc, const string& enableArg)
|
||||||
{
|
{
|
||||||
|
string daemon = ASSETCHAINS_SYMBOL[0] == 0 ? "komodod" : "hushd";
|
||||||
|
string ticker = ASSETCHAINS_SYMBOL[0] == 0 ? "komodo" : ASSETCHAINS_SYMBOL;
|
||||||
|
|
||||||
return "\nWARNING: " + rpc + " is disabled.\n"
|
return "\nWARNING: " + rpc + " is disabled.\n"
|
||||||
"To enable it, restart zcashd with the -experimentalfeatures and\n"
|
"To enable it, restart " + daemon + " with the -experimentalfeatures and\n"
|
||||||
"-" + enableArg + " commandline options, or add these two lines\n"
|
"-" + enableArg + " commandline options, or add these two lines\n"
|
||||||
"to the zcash.conf file:\n\n"
|
"to the " + ticker + ".conf file:\n\n"
|
||||||
"experimentalfeatures=1\n"
|
"experimentalfeatures=1\n"
|
||||||
+ enableArg + "=1\n";
|
+ enableArg + "=1\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,6 +267,7 @@ extern UniValue oraclesaddress(const UniValue& params, bool fHelp);
|
|||||||
extern UniValue oracleslist(const UniValue& params, bool fHelp);
|
extern UniValue oracleslist(const UniValue& params, bool fHelp);
|
||||||
extern UniValue oraclesinfo(const UniValue& params, bool fHelp);
|
extern UniValue oraclesinfo(const UniValue& params, bool fHelp);
|
||||||
extern UniValue oraclescreate(const UniValue& params, bool fHelp);
|
extern UniValue oraclescreate(const UniValue& params, bool fHelp);
|
||||||
|
extern UniValue oraclesfund(const UniValue& params, bool fHelp);
|
||||||
extern UniValue oraclesregister(const UniValue& params, bool fHelp);
|
extern UniValue oraclesregister(const UniValue& params, bool fHelp);
|
||||||
extern UniValue oraclessubscribe(const UniValue& params, bool fHelp);
|
extern UniValue oraclessubscribe(const UniValue& params, bool fHelp);
|
||||||
extern UniValue oraclesdata(const UniValue& params, bool fHelp);
|
extern UniValue oraclesdata(const UniValue& params, bool fHelp);
|
||||||
|
|||||||
@@ -4353,8 +4353,9 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
|
|||||||
//else if ( ASSETCHAINS_PRIVATE != 0 && komodo_isnotaryvout((char *)address.c_str()) == 0 )
|
//else if ( ASSETCHAINS_PRIVATE != 0 && komodo_isnotaryvout((char *)address.c_str()) == 0 )
|
||||||
// throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "cant use transparent addresses in private chain");
|
// throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "cant use transparent addresses in private chain");
|
||||||
|
|
||||||
if (setAddress.count(address))
|
// Allowing duplicate receivers helps various HushList protocol operations
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+address);
|
//if (setAddress.count(address))
|
||||||
|
// throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+address);
|
||||||
setAddress.insert(address);
|
setAddress.insert(address);
|
||||||
|
|
||||||
UniValue memoValue = find_value(o, "memo");
|
UniValue memoValue = find_value(o, "memo");
|
||||||
@@ -6760,6 +6761,26 @@ UniValue oraclesinfo(const UniValue& params, bool fHelp)
|
|||||||
return(OracleInfo(txid));
|
return(OracleInfo(txid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UniValue oraclesfund(const UniValue& params, bool fHelp)
|
||||||
|
{
|
||||||
|
UniValue result(UniValue::VOBJ); uint256 txid; std::string hex;
|
||||||
|
if ( fHelp || params.size() != 1 )
|
||||||
|
throw runtime_error("oraclesfund oracletxid\n");
|
||||||
|
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
|
||||||
|
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||||
|
const CKeyStore& keystore = *pwalletMain;
|
||||||
|
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||||
|
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||||
|
hex = OracleFund(0,txid);
|
||||||
|
RETURN_IF_ERROR(CCerror);
|
||||||
|
if ( hex.size() > 0 )
|
||||||
|
{
|
||||||
|
result.push_back(Pair("result", "success"));
|
||||||
|
result.push_back(Pair("hex", hex));
|
||||||
|
} else ERR_RESULT("couldnt fund with oracle txid");
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
UniValue oraclesregister(const UniValue& params, bool fHelp)
|
UniValue oraclesregister(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
UniValue result(UniValue::VOBJ); uint256 txid; int64_t datafee; std::string hex;
|
UniValue result(UniValue::VOBJ); uint256 txid; int64_t datafee; std::string hex;
|
||||||
@@ -6806,17 +6827,17 @@ UniValue oraclessubscribe(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
UniValue oraclessamples(const UniValue& params, bool fHelp)
|
UniValue oraclessamples(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
UniValue result(UniValue::VOBJ); uint256 txid,batontxid; int32_t num;
|
UniValue result(UniValue::VOBJ); uint256 txid; int32_t num; char *batonaddr;
|
||||||
if ( fHelp || params.size() != 3 )
|
if ( fHelp || params.size() != 3 )
|
||||||
throw runtime_error("oraclessamples oracletxid batonutxo num\n");
|
throw runtime_error("oraclessamples oracletxid batonaddress num\n");
|
||||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
|
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
|
||||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||||
const CKeyStore& keystore = *pwalletMain;
|
const CKeyStore& keystore = *pwalletMain;
|
||||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||||
batontxid = Parseuint256((char *)params[1].get_str().c_str());
|
batonaddr = (char *)params[1].get_str().c_str();
|
||||||
num = atoi((char *)params[2].get_str().c_str());
|
num = atoi((char *)params[2].get_str().c_str());
|
||||||
return(OracleDataSamples(txid,batontxid,num));
|
return(OracleDataSamples(txid,batonaddr,num));
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue oraclesdata(const UniValue& params, bool fHelp)
|
UniValue oraclesdata(const UniValue& params, bool fHelp)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
tools=("gcc-6" "g++-6" "otool" "nm")
|
tools=("gcc-8" "g++-8" "otool" "nm")
|
||||||
|
|
||||||
echo "Platform: `uname -a`"
|
echo "Platform: `uname -a`"
|
||||||
echo "-------------------------------------"
|
echo "-------------------------------------"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export CC=gcc-6
|
export CC=gcc-8
|
||||||
export CXX=g++-6
|
export CXX=g++-8
|
||||||
export LIBTOOL=libtool
|
export LIBTOOL=libtool
|
||||||
export AR=ar
|
export AR=ar
|
||||||
export RANLIB=ranlib
|
export RANLIB=ranlib
|
||||||
@@ -52,7 +52,7 @@ cd $WD
|
|||||||
|
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
|
CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
|
||||||
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@6/6.4.0_2/include/c++/6.4.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
|
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
|
||||||
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
|
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
|
||||||
|
|
||||||
make "$@" V=1 NO_GTEST=1 STATIC=1
|
make "$@" V=1 NO_GTEST=1 STATIC=1
|
||||||
|
|||||||
Reference in New Issue
Block a user