From a693b03b6468c716dce85a6d416e280026b87d06 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 19 Mar 2018 16:53:27 +0200 Subject: [PATCH 01/32] -print --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 793c255a7..e301b6d39 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -241,7 +241,7 @@ int32_t dpow_txhasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supe { if ( ((1LL << j) & notarymask) == 0 ) { - printf("n%d ",j); + //printf("n%d ",j); numnotaries++; notarymask |= (1LL << j); break; From 3b0abba07997aef7e4b324279026896b08b45390 Mon Sep 17 00:00:00 2001 From: bashgnu <38274202+bashgnu@users.noreply.github.com> Date: Sun, 15 Apr 2018 14:40:51 +0800 Subject: [PATCH 02/32] Update LICENSE --- LEGAL/LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LEGAL/LICENSE b/LEGAL/LICENSE index 67f75dcd8..50c41bc79 100755 --- a/LEGAL/LICENSE +++ b/LEGAL/LICENSE @@ -1,4 +1,4 @@ -Copyright © 2013-2015 The SuperNET Developers. +Copyright © 2013-2018 The SuperNET Developers. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2, From 83e7101b8a0a504ef4ee94bfec0c24b7a6c50149 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Sat, 9 Jun 2018 13:39:39 -0700 Subject: [PATCH 03/32] Add hush_7776 --- iguana/coins/hush_7776 | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 iguana/coins/hush_7776 diff --git a/iguana/coins/hush_7776 b/iguana/coins/hush_7776 new file mode 100755 index 000000000..2181d3cdf --- /dev/null +++ b/iguana/coins/hush_7776 @@ -0,0 +1,3 @@ +#!/bin/bash + +curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"hush.conf\",\"path\":\"${HOME#"/"}/.hush\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":8,\"endpend\":8,\"services\":129,\"maxpeers\":32,\"newcoin\":\"HUSH\",\"name\":\"Hush\",\"hasheaders\":0,\"useaddmultisig\":0,\"netmagic\":\"24e92764\",\"p2p\":8888,\"rpc\":8822,\"pubval\":184,\"p2shval\":189,\"wifval\":128,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"0003a67bc26fe564b75daf11186d360652eb435a35ba3d9d3e7e5d5f8e62dc17\",\"protover\":170002,\"genesisblock\":\"04000000000000000000000000000000000000000000000000000000000000000000000077e16b66afd4fe560cf16abf7bba8e661ba574b6389675a2366f19ecf939058300000000000000000000000000000000000000000000000000000000000000008be02d58ffff071f0000000000000000000000000000000000000000000000000000000000000512fd40050045f33727869d999e1d90de13eec508bb9eedf7c623ae0926922a749df12927967ce41f0363365e536a149ced0a25ce7258bcf4d36c9d69ea830ecafaac0a20576ee2405fa6e1ed91e5e5f3e72add8dae92175e05bb114100c654b90a0ea0e35e3ecee480d073b90c0d252963519492dce839f14bd3e54b017972fe05c30f61d73437d2ccb8a8dac1f33ba27c9d8a81bc02911a0f04f0af099ba8cc9114bd0de60fcd699673bc7a05d06baf544c5daa773991ff85c269c17f3a58618818f91d6ee9e4c393cd8d03428a2cc9be4243384caf197c77029b8c6c9387ab7a4966faac8efb13f7f9e259040fbbc1295551ad10084dba5ef0b732da7c90bd06026152acc74aad871aa3c2e46666d262129f07e128a0ea322b532851d649d2e0443954dafaaddfa6af28a70c786b94d904cb8ad3fda5364d9d5cccd1ce802f801dad25644a7dcab1c44191f24cdd8997f19c3602bc6e936aca34413a3270f837d94b211c5ad7533a070fe7b5651db5bf5d2aa13d503af5eef912fdcb5704a1bfc4c095d9b3da8f62261ed0dea089bf5b12db067ce1b4bee14f6515a180dedfeac9d794649da2b203e2a975db5c961daf788239ec722a7afbc63b8cb30c11e0ce1943f71981c3437530a4c0fcec0f9e7c6c1f5e85373ff132ddccb202916665c5559ddbcff20c743f15e2b7748a11d5de283f8cf190cb0c47feec730f6bde470ae172b9fdfc07e96362dd9238833876ff14b8028e811af7610b08842aac55f79f066e5df160104bd571f44fb16d7476e2626458c2992f6291781915d5ee927594c8a5966ba379ace56cf30a9c5f79e70fa6347e664796eea268d74862522ac275bf94ef2e406034ff121345351b92245ba834c752249d3506a111407bbd10e31b1167f9c3702fc54176e18ad8ca6211c892d4ba4598b3d834c2aa06392e21b4ff3d6d510132989a9828086bbbd1e03debe3fd44e34550c54103df97e25709e086efefc27013b9fc08bc777f96630876dfcba638d5f1f2fe10935d5fb950388ca485044535350e83267d0b5c75e5f570cd849d8567daecb90b011f72bccde31e8c6b13a630b82dc1fe68f7ef261013e2a91ed033c11fa201f4a32f7a05a58cbbce0a13f175c5e08a3ced164686a26277be7bbac9fed583276d12d67a12649b4f46e466bdc57bed60c3f8bd6e05f73d54686d36e97a6461cbda430abf9ec8df6699160822abbc947463338741c961fcaab0dbbd2a2b92084d0b372242e6103aa54479fc7b350f35c23eb1f3161352ec3e1ba178fd82147ff42ba02164405fe74606b6c525883dddc5fd8431bb49c889571c155974af19291e49f55fbfe7c823f526f77edc9bba773f9e370baf614175515eef3f7be1750ee2a3c915a0f8e3ea31bdd397668ebef7f0cf75ddecec887df2baf771e1013d2d4795c39ba8449c18d559eab9c2718f39531c0b632437506c9061ee9995e11173da85948b5b82e02e54977eb64db682af9a1993bbd16fcab3d55be7493a38ab9012d6c3f5834f3740fcc725aa70e0570b46073ad43c7b0a582af576f8e2afd4c6c75d933b0d8955a49c2b522d84a9fc9c75bbf2b5363667e5b42b420eddfa537ac5d15d7a4ea9c5dfd063cb03e81da219163fe7135d61db9d19f891e5784613a59df7ffefa2017f8d6edfde9ce19babd5963aae94ad7bfd52e736323c73f9765c9026f1b0a560dbdcc71563586f4ced072c0903bdf6362fe4f4c0cea265ad48a6639bccaa08b5593a9f0eeac5cfcc14ca6d2e7449ec029598b4061793745ba3e53dc289c16ee84c7c2575824e7a5e372d8c8e1bf0a2dfa90283a67bd305c684b39af1d109004522301344a9c346a0e227c45749aa24b11623211155bad78e1a137376738662a78619dceaf0c79f0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff071f0104455a6461736865353430656366313030303031383839383336633764343931613266343465366263363037366435396535653331373235353934366237316265336663353136ffffffff010000000000000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000\",\"debug\":0}" From 7ff947a5004fd0bf0aad57bb9916fb4e9f503659 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 11 Sep 2018 19:52:43 -1100 Subject: [PATCH 04/32] Update balances --- iguana/exchanges/autoprice | 2 +- iguana/exchanges/fundvalue | 2 +- iguana/exchanges/mshark | 2 +- iguana/exchanges/prices/autoprice | 4 ++-- iguana/exchanges/supernet | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/autoprice b/iguana/exchanges/autoprice index 52fc68df0..68e45e893 100755 --- a/iguana/exchanges/autoprice +++ b/iguana/exchanges/autoprice @@ -39,7 +39,7 @@ sharkholdings="{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"komodo\",\"b curl --url "http://127.0.0.1:7783" --data "{\"base\":\"MSHARK\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"margin\":$margin,\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[$sharkholdings],\"divisor\":1400000}" -curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"SUPERNET\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"NAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":20000000}, {\"coin\":\"waves\",\"balance\":700000}, {\"coin\":\"bitcoin\",\"balance\":600}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"chips\",\"balance\":2577006 }, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }],\"divisor\":612529}" +curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"SUPERNET\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"NAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":20000000}, {\"coin\":\"waves\",\"balance\":700000}, {\"coin\":\"bitcoin\",\"balance\":486}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"chips\",\"balance\":2577006 }, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }],\"divisor\":612529}" curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"HODL\",\"rel\":\"KMD\",\"fundvalue_bid\":\"assetNAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RNcUaMUEFLxVwtTo7rgruhwYanGk1jTkeU\",\"holdings\":[{\"coin\":\"siacoin\",\"balance\":185000000,\"comment\":\"using siafunds equal to million siacoin\"}],\"divisor\":10000000}" diff --git a/iguana/exchanges/fundvalue b/iguana/exchanges/fundvalue index 3e46662f6..a6e7c5355 100755 --- a/iguana/exchanges/fundvalue +++ b/iguana/exchanges/fundvalue @@ -1,4 +1,4 @@ #!/bin/bash source userpass # this will only work for watchonly addresses that have been rescanned and with active coins -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":13000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":10000}, {\"coin\":\"syscoin\",\"balance\":20000000}, {\"coin\":\"waves\",\"balance\":700000}, {\"coin\":\"bitcoin\",\"balance\":625}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":375000}, {\"coin\":\"chips\",\"balance\":2577006 }, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }],\"divisor\":650000}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":13000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":10000}, {\"coin\":\"syscoin\",\"balance\":20000000}, {\"coin\":\"waves\",\"balance\":600000}, {\"coin\":\"bitcoin\",\"balance\":486}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":375000}, {\"coin\":\"chips\",\"balance\":2577006 }, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }],\"divisor\":650000}" diff --git a/iguana/exchanges/mshark b/iguana/exchanges/mshark index fa3ae0a64..1297dd851 100755 --- a/iguana/exchanges/mshark +++ b/iguana/exchanges/mshark @@ -1,4 +1,4 @@ #!/bin/bash source userpass # this will only work for watchonly addresses that have been rescanned and with active coins -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}, {\"coin\":\"bitcoin\",\"balance\":25}],\"divisor\":1400000}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}],\"divisor\":1400000}" diff --git a/iguana/exchanges/prices/autoprice b/iguana/exchanges/prices/autoprice index 8092b2bb2..4d7fa7733 100755 --- a/iguana/exchanges/prices/autoprice +++ b/iguana/exchanges/prices/autoprice @@ -35,11 +35,11 @@ source trackbtc #source revs #source trackbtc -sharkholdings="{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}, {\"coin\":\"bitcoin\",\"balance\":25}" +sharkholdings="{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}" curl --url "http://127.0.0.1:7783" --data "{\"base\":\"MSHARK\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"margin\":$margin,\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[$sharkholdings],\"divisor\":1400000}" -curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"SUPERNET\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"NAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":0.20000000}, {\"coin\":\"waves\",\"balance\":700000}, {\"coin\":\"bitcoin\",\"balance\":540}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"chips\",\"balance\":2577006 }, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }, {\"coin\":\"utrum\",\"balance\":2100000}, {\"coin\":\"verus\",\"balance\":65000}],\"divisor\":777777}" +curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"SUPERNET\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"NAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":0.20000000}, {\"coin\":\"waves\",\"balance\":600000}, {\"coin\":\"bitcoin\",\"balance\":486}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"chips\",\"balance\":2577006 }, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }, {\"coin\":\"utrum\",\"balance\":2100000}, {\"coin\":\"verus\",\"balance\":65000}],\"divisor\":777777}" curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"HODL\",\"rel\":\"KMD\",\"fundvalue_bid\":\"assetNAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RNcUaMUEFLxVwtTo7rgruhwYanGk1jTkeU\",\"holdings\":[{\"coin\":\"siacoin\",\"balance\":185000000,\"comment\":\"using siafunds equal to million siacoin\"}],\"divisor\":10000000}" diff --git a/iguana/exchanges/supernet b/iguana/exchanges/supernet index e7e11b43f..20595997b 100755 --- a/iguana/exchanges/supernet +++ b/iguana/exchanges/supernet @@ -15,5 +15,5 @@ echo supernet curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"balances\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\"}" echo supernet -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":0.20000000}, {\"coin\":\"waves\",\"balance\":700000}, {\"coin\":\"bitcoin\",\"balance\":540}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }, {\"coin\":\"utrum\",\"balance\":2350000}, {\"coin\":\"verus\",\"balance\":65000}],\"divisor\":777777}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":0.20000000}, {\"coin\":\"waves\",\"balance\":600000}, {\"coin\":\"bitcoin\",\"balance\":486}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }, {\"coin\":\"utrum\",\"balance\":2350000}, {\"coin\":\"verus\",\"balance\":65000}],\"divisor\":777777}" From efd9eab3bded8a50effd339c209ecf9e93aa051d Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Tue, 18 Sep 2018 03:04:59 +0300 Subject: [PATCH 05/32] fix win build of iguana: prevent winsock.h inclusion in dtls1.h --- OSlibs/win/mingw.h | 4 ++-- crypto777/OS_nonportable.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OSlibs/win/mingw.h b/OSlibs/win/mingw.h index 2c35aa78c..5690d6f91 100755 --- a/OSlibs/win/mingw.h +++ b/OSlibs/win/mingw.h @@ -5,8 +5,8 @@ #include #define _USE_W32_SOCKETS 1 -#define WIN32_LEAN_AND_MEAN -#include +//#define WIN32_LEAN_AND_MEAN +//#include #include #define PTW32_STATIC_LIB #include "pthread.h" diff --git a/crypto777/OS_nonportable.c b/crypto777/OS_nonportable.c index ca3f90695..d46fb2b1b 100755 --- a/crypto777/OS_nonportable.c +++ b/crypto777/OS_nonportable.c @@ -26,10 +26,10 @@ * not from the mingw header, so we need to include the windows header * if we are compiling in windows 64bit */ -//#if defined(_M_X64) -//#define WIN32_LEAN_AND_MEAN -//#include -//#endif +#if defined(_M_X64) +#define WIN32_LEAN_AND_MEAN +#include +#endif #include "OS_portable.h" From 3379129399677e10f0d0e2f5de72229605400e0c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 17:54:47 +0800 Subject: [PATCH 06/32] Lock UTXO code added for testing --- iguana/dpow/dpow_fsm.c | 38 +++++++++++++++++++++++++++++++++++++- iguana/dpow/dpow_rpc.c | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index c531c27a7..308e57cd3 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -265,6 +265,7 @@ void dpow_statemachinestart(void *ptr) void **ptrs = ptr; struct supernet_info *myinfo; struct dpow_info *dp; struct dpow_checkpoint checkpoint; int32_t i,j,ht,extralen,destprevvout0,srcprevvout0,src_or_dest,numratified=0,kmdheight,myind = -1; uint8_t extras[10000],pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,MoM,merkleroot,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t MoMdepth,duration,minsigs,starttime,srctime; + char *destlockunspent,*srclockunspent,*destunlockunspent,*srcunlockunspent; memset(&zero,0,sizeof(zero)); MoM = zero; srcprevtxid0 = destprevtxid0 = zero; @@ -501,6 +502,29 @@ void dpow_statemachinestart(void *ptr) bp->desttxid = bp->notaries[myind].src.prev_hash; dpow_signedtxgen(myinfo,dp,src,bp,bp->myind,1LL<myind,bp->myind,DPOW_SIGCHANNEL,0,0); }*/ + + if (strcmp("KMD",dest->symbol) == 0 ) + { + // lock the dest utxo if destination coin is KMD. + destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + if (strncmp(destlockunspent,"true", 4) == 0 ) + printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + else + printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + free(destlockunspent); + } + + if ( strcmp("BTC",dest->symbol) == 0 ) + { + // lock the src coin selected utxo if the source coin is KMD. + srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + if (strncmp(srclockunspent,"true", 4) == 0 ) + printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + else + printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + free(srclockunspent); + } + bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); dp->checkpoint = checkpoint; @@ -594,8 +618,20 @@ void dpow_statemachinestart(void *ptr) printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest); dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; + + // unlock the dest utxo regardless if it was locked or not it does not matter. + destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + if (strncmp(destunlockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + free(destunlockunspent); + + // unlock the src selected utxo, if it was locked or not it does not matter. + srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + if (strncmp(srcunlockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + free(srcunlockunspent); + // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; free(ptr); } - diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index edcd687d3..447de82bc 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -236,7 +236,7 @@ bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *c } else { - + } if ( bits256_nonz(blockhash) != 0 ) { @@ -370,6 +370,36 @@ bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin, return(blockhash); } +char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) +{ + char buf[128],*retstr; + if ( coin->FULLNODE < 0 ) + { + sprintf(buf,"false, [{\"txid\":\"%s\",\"vout\":%d}]", txid, vout); + if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) + { + //printf("RESULT.(%s)\n",retstr); + return(retstr); + } else printf("%s null retstr from (%s)n",coin->symbol,buf); + } + return(0); +} + +char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) +{ + char buf[128],*retstr; + if ( coin->FULLNODE < 0 ) + { + sprintf(buf,"true, [{\"txid\":\"%s\",\"vout\":%d}]", txid, vout); + if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) + { + //printf("RESULT.(%s)\n",retstr); + return(retstr); + } else printf("%s null retstr from (%s)n",coin->symbol,buf); + } + return(0); +} + cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash) { char buf[128],str[65],*retstr=0; cJSON *json = 0; @@ -399,7 +429,7 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2 int32_t dpow_is015(char *symbol) { - if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 ) //strcmp("BTC",symbol) == 0 || + if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 ) //strcmp("BTC",symbol) == 0 || return(1); else return(0); } @@ -1254,7 +1284,7 @@ void dpow_issuer_voutupdate(struct dpow_info *dp,char *symbol,int32_t isspecial, printf(" opret[%c] fiatoshis %.8f vs check %.8f\n",script[0],dstr(fiatoshis),dstr(checktoshis)); if ( seed == 0 || fiatoshis < checktoshis ) { - + }*/ } } @@ -1424,4 +1454,3 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3 //printf("[%s -> %s] %s ht.%d current.%d\n",dp->symbol,dp->dest,coin->symbol,height,currentheight); return(height); } - From daa2549ab5e5e8055dd80e9e81426ad94333744c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 18:24:42 +0800 Subject: [PATCH 07/32] fix unlock on utxo not locked, CHIPS got really angry --- iguana/dpow/dpow_fsm.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 308e57cd3..5b6734ff0 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -618,18 +618,24 @@ void dpow_statemachinestart(void *ptr) printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest); dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; - - // unlock the dest utxo regardless if it was locked or not it does not matter. - destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - if (strncmp(destunlockunspent,"true", 4) == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - free(destunlockunspent); - // unlock the src selected utxo, if it was locked or not it does not matter. - srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - if (strncmp(srcunlockunspent,"true", 4) == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - free(srcunlockunspent); + // unlock the dest utxo on KMD. + if (strcmp("KMD",dest->symbol) == 0 ) + { + destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + if (strncmp(destunlockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + free(destunlockunspent); + } + + // unlock the src selected utxo on KMD, as those are the only ones we LOCK, and CHIPS does not like the lockunspent call. + if ( strcmp("BTC",dest->symbol) == 0 ) + { + srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + if (strncmp(srcunlockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + free(srcunlockunspent); + } // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; From 0e3d6913b23d11500507792876eeb70785e6a03e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 18:42:50 +0800 Subject: [PATCH 08/32] Add purge of lockunspent on m_notary_run --- iguana/m_notary_run | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/m_notary_run b/iguana/m_notary_run index fde6f4db9..b554ffa4e 100755 --- a/iguana/m_notary_run +++ b/iguana/m_notary_run @@ -1,4 +1,6 @@ #!/bin/bash +# Unlock all lockunspents to make sure we can access all our utxo! +komodo-cli lockunspent true `komodo-cli listlockunspent | jq -c .` cd secp256k1; ./m_unix; cd .. cd ../crypto777; ./m_LP; cd ../iguana From ae70f91481dbe7e12cb69708fc9552b0e1241ec3 Mon Sep 17 00:00:00 2001 From: 3cl1ps Date: Thu, 20 Sep 2018 21:57:16 +0200 Subject: [PATCH 09/32] Update m_notary_run --- iguana/m_notary_run | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/m_notary_run b/iguana/m_notary_run index fde6f4db9..b49cf3183 100755 --- a/iguana/m_notary_run +++ b/iguana/m_notary_run @@ -41,6 +41,7 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"ad curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"217.182.203.106\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"149.56.19.212\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"95.213.205.222\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"144.217.11.235\"}" #tests/addnotarys_7776 From 3ccea559584e4067cd40963e03bfaa72d6982d98 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 21 Sep 2018 01:53:31 +0300 Subject: [PATCH 10/32] First approach to make iguana work with 2 bytes prefix coins, like HUSH Main additions: + bitcoin_address_ex + bitcoin_addr2rmd160_ex These functions with support taddr param. For example, for HUSH prefix is { 0x1C, 0xB8 }, where is taddr = 0x1C and addrtype = 0xB8. All functions that used bitcoin_address and bitcoin_addr2rmd160 should be rewritten with new *_ex analogs. currently it's done only for functions used in split funds. Also, if we want to support other type of such coins, we should change condition "if (strcmp(coin->chain->symbol, "HUSH") == 0)" on more universal. For example we can taddr in struct iguana_chain, but this needs to rewrite all logic, for example, init structures, init static struct iguana_chain Chains[] array and other things. Adding prefix byte causes global changes in iguana. p.s. With these changes HUSH splitfund in iguana works fine, but we need to test notarizations on testnet (!) first, and change these functions calls: bitcoin_address -> bitcoin_address_ex bitcoin_addr2rmd160 -> bitcoin_addr2rmd160_ex everywhere it used. This is not finished yet. --- basilisk/basilisk_bitcoin.c | 7 +++- iguana/exchanges/bitcoin.c | 81 +++++++++++++++++++++++++++++++++++++ iguana/exchanges/bitcoin.h | 1 + iguana/iguana_payments.c | 7 +++- iguana/iguana_wallet.c | 54 +++++++++++++++++++------ includes/iguana_funcs.h | 1 + 6 files changed, 137 insertions(+), 14 deletions(-) diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index 4d15df781..be78a05e2 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -584,7 +584,12 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi *completedp = 0; if ( signedtxidp != 0 ) memset(signedtxidp,0,sizeof(*signedtxidp)); - bitcoin_address(changeaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33); + + if (strcmp(coin->chain->symbol, "HUSH") == 0) + bitcoin_address_ex(coin->chain->symbol, changeaddr, 0x1c, coin->chain->pubtype, myinfo->persistent_pubkey33, 33); + else + bitcoin_address(changeaddr, coin->chain->pubtype, myinfo->persistent_pubkey33, 33); + txfee = (coin->txfee + duplicates*coin->txfee/10); if ( strcmp(coin->symbol,"GAME") == 0 ) printf("GAME txfee %.8f\n",dstr(txfee)); diff --git a/iguana/exchanges/bitcoin.c b/iguana/exchanges/bitcoin.c index 62c0ed592..f7a5661fa 100755 --- a/iguana/exchanges/bitcoin.c +++ b/iguana/exchanges/bitcoin.c @@ -22,6 +22,51 @@ char *bitcoind_passthru(char *coinstr,char *serverport,char *userpass,char *meth return(bitcoind_RPC(0,coinstr,serverport,userpass,method,params,0)); } + +int32_t bitcoin_addr2rmd160_ex(char *symbol, uint8_t taddr, uint8_t *addrtypep, uint8_t rmd160[20], char *coinaddr) +{ + bits256 hash; uint8_t *buf, _buf[26], data5[128], rmd21[21]; char prefixaddr[64], hrp[64]; int32_t len, len5, offset; + *addrtypep = 0; + memset(rmd160, 0, 20); + if (coinaddr == 0 || coinaddr[0] == 0) + return(0); + if (coinaddr[0] == '0' && coinaddr[1] == 'x' && is_hexstr(coinaddr + 2, 0) == 40) // for ETH + { + decode_hex(rmd160, 20, coinaddr + 2); // not rmd160 hash but hopefully close enough; + return(20); + } + + offset = 1 + (taddr != 0); + memset(rmd160, 0, 20); + *addrtypep = 0; + buf = _buf; + if ((len = bitcoin_base58decode(buf, coinaddr)) >= 4) + { + // validate with trailing hash, then remove hash + hash = bits256_doublesha256(0, buf, 20 + offset); + + *addrtypep = (taddr == 0) ? *buf : buf[1]; + memcpy(rmd160, buf + offset, 20); + if ((buf[20 + offset] & 0xff) == hash.bytes[31] && (buf[21 + offset] & 0xff) == hash.bytes[30] && (buf[22 + offset] & 0xff) == hash.bytes[29] && (buf[23 + offset] & 0xff) == hash.bytes[28]) + { + //printf("coinaddr.(%s) valid checksum addrtype.%02x\n",coinaddr,*addrtypep); + return(20); + } + else if ((strcmp(symbol, "GRS") == 0 || strcmp(symbol, "SMART") == 0) && (buf[20 + offset] & 0xff) == hash.bytes[0] && (buf[21 + offset] & 0xff) == hash.bytes[1] && (buf[22 + offset] & 0xff) == hash.bytes[2] && (buf[23 + offset] & 0xff) == hash.bytes[3]) + return(20); + else if (strcmp(symbol, "BTC") != 0 || *addrtypep == 0 || *addrtypep == 5) + { + int32_t i; + //if ( len > 20 ) + // hash = bits256_calcaddrhash(symbol,buf,len); + for (i = 0; isymbol, "HUSH") == 0) + bitcoin_addr2rmd160_ex(coin->symbol, 0x1c, &addrtype, rmd160, changeaddr); + else + bitcoin_addr2rmd160(&addrtype,rmd160,changeaddr); + spendlen = bitcoin_standardspend(spendscript,0,rmd160); bitcoin_txoutput(txobj,spendscript,spendlen,change); if ( opreturn != 0 ) diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index d633ff569..3c46ff1fb 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -321,7 +321,10 @@ cJSON *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_i { HASH_ITER(hh,subset->waddr,waddr,tmp2) { - bitcoin_address(coinaddr,coin->chain->pubtype,waddr->rmd160,20); + if (strcmp(coin->chain->symbol, "HUSH") == 0) + bitcoin_address_ex(coin->chain->symbol, coinaddr, 0x1c, coin->chain->pubtype, waddr->rmd160, 20); + else + bitcoin_address(coinaddr, coin->chain->pubtype, waddr->rmd160, 20); printf("%s ",coinaddr); jaddistr(array,coinaddr); } @@ -329,12 +332,20 @@ cJSON *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_i } else { - bitcoin_address(refaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33); - HASH_ITER(hh,myinfo->wallet,subset,tmp) + if (strcmp(coin->chain->symbol, "HUSH") == 0) + bitcoin_address_ex(coin->chain->symbol, refaddr, 0x1c, coin->chain->pubtype, myinfo->persistent_pubkey33, 33); + else + bitcoin_address(refaddr, coin->chain->pubtype, myinfo->persistent_pubkey33, 33); + + HASH_ITER(hh,myinfo->wallet,subset,tmp) { HASH_ITER(hh,subset->waddr,waddr,tmp2) { - bitcoin_address(coinaddr,coin->chain->pubtype,waddr->rmd160,20); + if (strcmp(coin->chain->symbol, "HUSH") == 0) + bitcoin_address_ex(coin->chain->symbol, coinaddr, 0x1c, coin->chain->pubtype, waddr->rmd160, 20); + else + bitcoin_address(coinaddr, coin->chain->pubtype, waddr->rmd160, 20); + jaddistr(array,coinaddr); if ( strcmp(coinaddr,refaddr) == 0 ) refaddr[0] = 0; @@ -359,17 +370,36 @@ int32_t iguana_addressvalidate(struct iguana_info *coin,uint8_t *addrtypep,char char checkaddr[64]; uint8_t rmd160[20]; *addrtypep = 0; memset(rmd160,0,sizeof(rmd160)); - bitcoin_addr2rmd160(addrtypep,rmd160,address); + + if (strcmp(coin->symbol, "HUSH") == 0) + bitcoin_addr2rmd160_ex(coin->symbol, 0x1c, addrtypep, rmd160, address); + else + bitcoin_addr2rmd160(addrtypep,rmd160,address); + //int32_t i; for (i=0; i<20; i++) // printf("%02x",rmd160[i]); // 764692cd5473f62ffa8a93e55d876f567623de07 //printf(" rmd160 addrtype.%02x\n",*addrtypep); - if ( bitcoin_address(checkaddr,*addrtypep,rmd160,20) == checkaddr && strcmp(address,checkaddr) == 0 && (*addrtypep == coin->chain->pubtype || *addrtypep == coin->chain->p2shtype) ) - return(0); - else - { - //printf(" checkaddr.(%s) address.(%s) type.%02x vs (%02x %02x)\n",checkaddr,address,*addrtypep,coin->chain->pubtype,coin->chain->p2shtype); - return(-1); - } + + if (strcmp(coin->symbol, "HUSH") == 0) + { + if (bitcoin_address_ex(coin->symbol, checkaddr, 0x1c, *addrtypep, rmd160, 20) == checkaddr && strcmp(address, checkaddr) == 0 && (*addrtypep == coin->chain->pubtype || *addrtypep == coin->chain->p2shtype)) + return(0); + else + { + //printf(" checkaddr.(%s) address.(%s) type.%02x vs (%02x %02x)\n",checkaddr,address,*addrtypep,coin->chain->pubtype,coin->chain->p2shtype); + return(-1); + } + } + else + { + if (bitcoin_address(checkaddr, *addrtypep, rmd160, 20) == checkaddr && strcmp(address, checkaddr) == 0 && (*addrtypep == coin->chain->pubtype || *addrtypep == coin->chain->p2shtype)) + return(0); + else + { + //printf(" checkaddr.(%s) address.(%s) type.%02x vs (%02x %02x)\n",checkaddr,address,*addrtypep,coin->chain->pubtype,coin->chain->p2shtype); + return(-1); + } + } } cJSON *iguana_waddressjson(struct iguana_info *coin,cJSON *item,struct iguana_waddress *waddr) diff --git a/includes/iguana_funcs.h b/includes/iguana_funcs.h index b0fa20b84..946584592 100755 --- a/includes/iguana_funcs.h +++ b/includes/iguana_funcs.h @@ -560,6 +560,7 @@ bits256 calc_categoryhashes(bits256 *subhashp,char *category,char *subcategory); struct gecko_chain *category_find(bits256 categoryhash,bits256 subhash); void *category_subscribe(struct supernet_info *myinfo,bits256 category,bits256 keyhash); char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len); +char *bitcoin_address_ex(char *symbol, char *coinaddr, uint8_t taddr, uint8_t addrtype, uint8_t *pubkey_or_rmd160, int32_t len); char *SuperNET_JSON(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *json,char *remoteaddr,uint16_t port); int64_t iguana_txdetails(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *item,bits256 txid,int32_t vout,int32_t height); int32_t iguana_txidheight(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid); From d65ba531bb17fdb35883e1bed1ac4cc9a9dd66e3 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 21 Sep 2018 01:57:23 +0300 Subject: [PATCH 11/32] bitcoin_addr2rmd160_ex -> iguana_funcs.h --- includes/iguana_funcs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/iguana_funcs.h b/includes/iguana_funcs.h index 946584592..934cc081a 100755 --- a/includes/iguana_funcs.h +++ b/includes/iguana_funcs.h @@ -327,6 +327,7 @@ char *_setVsigner(struct iguana_info *coin,struct vin_info *V,int32_t ind,char * char *bitcoin_json2hex(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,cJSON *txjson,struct vin_info *V); int32_t bitcoin_addr2rmd160(uint8_t *addrtypep,uint8_t rmd160[20],char *coinaddr); +int32_t bitcoin_addr2rmd160_ex(char *symbol, uint8_t taddr, uint8_t *addrtypep, uint8_t rmd160[20], char *coinaddr); char *issue_startForging(struct supernet_info *myinfo,char *secret); struct bitcoin_unspent *iguana_unspentsget(struct supernet_info *myinfo,struct iguana_info *coin,char **retstrp,double *balancep,int32_t *numunspentsp,double minconfirms,char *address); void iguana_chainparms(struct supernet_info *myinfo,struct iguana_chain *chain,cJSON *argjson); From a06cdb0106a8a0429b804380c9e4dd2a3d8cdacb Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 21 Sep 2018 02:25:15 +0300 Subject: [PATCH 12/32] fix HUSH dpow start before this commit we have error: {"error":"source address or dest address has no privkey, importprivkey","tag":"10659764395713204969"} on dpow start, bcz src coin (HUSH) address validate fails. --- iguana/iguana_notary.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index db3808263..a56fd6ecd 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -384,7 +384,12 @@ THREE_STRINGS_AND_DOUBLE(iguana,dpow,symbol,dest,pubkey,freq) char tmp[67]; safecopy(tmp,pubkey,sizeof(tmp)); decode_hex(dp->minerkey33,33,tmp); - bitcoin_address(srcaddr,src->chain->pubtype,dp->minerkey33,33); + + if (strcmp(src->chain->symbol, "HUSH") == 0) + bitcoin_address_ex(src->chain->symbol, srcaddr, 0x1c, src->chain->pubtype, dp->minerkey33, 33); + else + bitcoin_address(srcaddr, src->chain->pubtype, dp->minerkey33, 33); + if ( (retstr= dpow_validateaddress(myinfo,src,srcaddr)) != 0 ) { json = cJSON_Parse(retstr); From 303cb95f08c258edb9adb7c297416dd69f43a757 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 21 Sep 2018 03:59:44 +0300 Subject: [PATCH 13/32] +bitcoin_address_ex in dpow_statemachinestart --- iguana/dpow/dpow_fsm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 4301f8c3a..a7e007c81 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -384,8 +384,13 @@ void dpow_statemachinestart(void *ptr) return; } dp->ratifying += bp->isratify; - bitcoin_address(srcaddr,src->chain->pubtype,dp->minerkey33,33); - bitcoin_address(destaddr,dest->chain->pubtype,dp->minerkey33,33); + + if (strcmp(src->chain->symbol, "HUSH") == 0) + bitcoin_address_ex(src->chain->symbol, srcaddr, 0x1c, src->chain->pubtype, dp->minerkey33, 33); + else + bitcoin_address(srcaddr, src->chain->pubtype, dp->minerkey33, 33); + + bitcoin_address(destaddr,dest->chain->pubtype,dp->minerkey33,33); if ( kmdheight >= 0 ) { ht = kmdheight;///strcmp("KMD",src->symbol) == 0 ? kmdheight : bp->height; From a588931d61fc341b3995c525de9e4ea86d7089e2 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 21 Sep 2018 04:08:42 +0300 Subject: [PATCH 14/32] +bitcoin_address_ex in SuperNET_rosettajson (fix walletpassphrase output) --- iguana/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/iguana/main.c b/iguana/main.c index 571f45549..96ccaec3c 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -891,7 +891,7 @@ uint8_t *SuperNET_ciphercalc(void **ptrp,int32_t *cipherlenp,bits256 *privkeyp,b cJSON *SuperNET_rosettajson(struct supernet_info *myinfo,bits256 privkey,int32_t showprivs) { uint8_t rmd160[20],pub[33]; uint64_t nxt64bits; bits256 pubkey; - char str2[41],wifbuf[64],pbuf[65],addr[64],str[128],coinwif[16]; cJSON *retjson; struct iguana_info *coin,*tmp; + char str2[41],wifbuf[64],pbuf[65],addr[64],str[128],coinwif[16],*paddr = 0; cJSON *retjson; struct iguana_info *coin,*tmp; pubkey = acct777_pubkey(privkey); nxt64bits = acct777_nxt64bits(pubkey); retjson = cJSON_CreateObject(); @@ -910,7 +910,12 @@ cJSON *SuperNET_rosettajson(struct supernet_info *myinfo,bits256 privkey,int32_t { if ( coin != 0 && coin->symbol[0] != 0 ) { - if ( bitcoin_address(addr,coin->chain->pubtype,pub,33) != 0 ) + if (strcmp(coin->chain->symbol, "HUSH") == 0) + paddr = bitcoin_address_ex(coin->chain->symbol, addr, 0x1c, coin->chain->pubtype, pub, 33); + else + paddr = bitcoin_address(addr, coin->chain->pubtype, pub, 33); + + if ( paddr != 0 ) { jaddstr(retjson,coin->symbol,addr); sprintf(coinwif,"%swif",coin->symbol); From 4eabde521ee13ae68a0a69f524ca75f1b0e43fda Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 21 Sep 2018 04:34:41 +0300 Subject: [PATCH 15/32] possible heap corruption fix (revert this if i'm wrong) we allocate bp via calloc earlier, but didn't free it at the end of proc. --- iguana/dpow/dpow_fsm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index a7e007c81..b6d99be3a 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -265,7 +265,8 @@ void dpow_statemachinestart(void *ptr) void **ptrs = ptr; struct supernet_info *myinfo; struct dpow_info *dp; struct dpow_checkpoint checkpoint; int32_t i,j,ht,extralen,destprevvout0,srcprevvout0,src_or_dest,numratified=0,kmdheight,myind = -1; uint8_t extras[10000],pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,MoM,merkleroot,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t MoMdepth,duration,minsigs,starttime,srctime; - memset(&zero,0,sizeof(zero)); + int32_t bp_alloc = 0; + memset(&zero,0,sizeof(zero)); MoM = zero; srcprevtxid0 = destprevtxid0 = zero; srcprevvout0 = destprevvout0 = -1; @@ -297,7 +298,7 @@ void dpow_statemachinestart(void *ptr) } if ( (bp= dp->blocks[checkpoint.blockhash.height]) == 0 ) { - bp = calloc(1,sizeof(*bp)); + bp = calloc(1, sizeof(*bp)); bp_alloc = 1; //printf("allocate bp for %s ht.%d -> %s\n",src->symbol,checkpoint.blockhash.height,dest->symbol); Numallocated++; bp->MoM = MoM; @@ -596,6 +597,9 @@ void dpow_statemachinestart(void *ptr) dp->ratifying -= bp->isratify; // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; + + // heap corruption detected? + if (bp_alloc) free(bp); free(ptr); } From 9065c0ab4763875c516e000220f5199c918fe198 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 10 Aug 2018 03:05:00 -1100 Subject: [PATCH 16/32] Attempt to fix deckers 00 bug --- iguana/dpow/dpow_network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 5343f33c6..1fe0d849c 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1869,13 +1869,13 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru return; if ( bp->isratify == 0 && bp->state != 0xffffffff && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 ) { - if ( bits256_nonz(srcutxo) != 0 ) + if ( senderind != bp->myind && bits256_nonz(srcutxo) != 0 ) { bp->notaries[senderind].src.prev_hash = srcutxo; bp->notaries[senderind].src.prev_vout = srcvout; //char str[65]; printf("%s senderind.%d <- %s/v%d\n",dp->symbol,senderind,bits256_str(str,srcutxo),srcvout); } - if ( bits256_nonz(destutxo) != 0 ) + if ( senderind != bp->myind && bits256_nonz(destutxo) != 0 ) { bp->notaries[senderind].dest.prev_hash = destutxo; bp->notaries[senderind].dest.prev_vout = destvout; From f7844bb94e9e419720b72596198ca1a72aee5577 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 10 Aug 2018 03:24:15 -1100 Subject: [PATCH 17/32] Mysrc/dest utxo --- iguana/dPoW.h | 2 +- iguana/dpow/dpow_fsm.c | 5 +++++ iguana/dpow/dpow_network.c | 22 +++++++++++++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/iguana/dPoW.h b/iguana/dPoW.h index f4cb5ebed..bc343f144 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -109,7 +109,7 @@ struct dpow_recvdata { uint64_t recvmask,bestmask; int8_t bestk; }; struct dpow_block { - bits256 hashmsg,desttxid,srctxid,beacon,commit,MoM; + bits256 hashmsg,desttxid,srctxid,beacon,commit,MoM,mysrcutxo,mydestutxo; struct iguana_info *srccoin,*destcoin; char *opret_symbol; uint64_t destsigsmasks[DPOW_MAXRELAYS],srcsigsmasks[DPOW_MAXRELAYS]; uint64_t recvmask,bestmask,ratifybestmask,ratifyrecvmask,pendingbestmask,pendingratifybestmask,ratifysigmasks[2]; diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index b6d99be3a..5e014059d 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -494,6 +494,11 @@ void dpow_statemachinestart(void *ptr) bp->notaries[myind].ratifydestutxo = ep->dest.prev_hash; bp->notaries[myind].ratifydestvout = ep->dest.prev_vout; } + else + { + bp->mysrcutxo = ep->src.prev_hash; + bp->mydestutxo = ep->dest.prev_hash; + } } /*if ( strcmp(dp->symbol,"CHIPS") == 0 && myind == 0 ) { diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 1fe0d849c..a13091b19 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1869,16 +1869,24 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru return; if ( bp->isratify == 0 && bp->state != 0xffffffff && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 ) { - if ( senderind != bp->myind && bits256_nonz(srcutxo) != 0 ) + if ( bp->myind != senderind ) { - bp->notaries[senderind].src.prev_hash = srcutxo; - bp->notaries[senderind].src.prev_vout = srcvout; - //char str[65]; printf("%s senderind.%d <- %s/v%d\n",dp->symbol,senderind,bits256_str(str,srcutxo),srcvout); + if ( bits256_nonz(srcutxo) != 0 ) + { + bp->notaries[senderind].src.prev_hash = srcutxo; + bp->notaries[senderind].src.prev_vout = srcvout; + //char str[65]; printf("%s senderind.%d <- %s/v%d\n",dp->symbol,senderind,bits256_str(str,srcutxo),srcvout); + } + if ( bits256_nonz(destutxo) != 0 ) + { + bp->notaries[senderind].dest.prev_hash = destutxo; + bp->notaries[senderind].dest.prev_vout = destvout; + } } - if ( senderind != bp->myind && bits256_nonz(destutxo) != 0 ) + else { - bp->notaries[senderind].dest.prev_hash = destutxo; - bp->notaries[senderind].dest.prev_vout = destvout; + bp->notaries[bp->myind].src.prev_hash = bp->mysrcutxo; + bp->notaries[bp->myind].dest.prev_hash = bp->mydestutxo; } if ( bestmask != 0 ) bp->notaries[senderind].bestmask = bestmask; From 7b27b308811fc2b54c44de410650588232621812 Mon Sep 17 00:00:00 2001 From: cipig Date: Fri, 21 Sep 2018 16:32:53 +0000 Subject: [PATCH 18/32] add cipi_AR and cipi_NA --- iguana/m_notary_run | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/m_notary_run b/iguana/m_notary_run index 4656e23a6..60aa8ff03 100755 --- a/iguana/m_notary_run +++ b/iguana/m_notary_run @@ -44,6 +44,8 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"ad curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"149.56.19.212\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"95.213.205.222\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"144.217.11.235\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"209.58.190.117\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"209.58.144.205\"}" #tests/addnotarys_7776 From 09e4cb9e7f62381a08ed99b241691fc2622f0cf5 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 21 Sep 2018 22:20:51 +0300 Subject: [PATCH 19/32] Revert "possible heap corruption fix (revert this if i'm wrong)" This reverts commit 4eabde521ee13ae68a0a69f524ca75f1b0e43fda. --- iguana/dpow/dpow_fsm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 5e014059d..743f96c67 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -265,8 +265,7 @@ void dpow_statemachinestart(void *ptr) void **ptrs = ptr; struct supernet_info *myinfo; struct dpow_info *dp; struct dpow_checkpoint checkpoint; int32_t i,j,ht,extralen,destprevvout0,srcprevvout0,src_or_dest,numratified=0,kmdheight,myind = -1; uint8_t extras[10000],pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,MoM,merkleroot,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t MoMdepth,duration,minsigs,starttime,srctime; - int32_t bp_alloc = 0; - memset(&zero,0,sizeof(zero)); + memset(&zero,0,sizeof(zero)); MoM = zero; srcprevtxid0 = destprevtxid0 = zero; srcprevvout0 = destprevvout0 = -1; @@ -298,7 +297,7 @@ void dpow_statemachinestart(void *ptr) } if ( (bp= dp->blocks[checkpoint.blockhash.height]) == 0 ) { - bp = calloc(1, sizeof(*bp)); bp_alloc = 1; + bp = calloc(1,sizeof(*bp)); //printf("allocate bp for %s ht.%d -> %s\n",src->symbol,checkpoint.blockhash.height,dest->symbol); Numallocated++; bp->MoM = MoM; @@ -602,9 +601,6 @@ void dpow_statemachinestart(void *ptr) dp->ratifying -= bp->isratify; // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; - - // heap corruption detected? - if (bp_alloc) free(bp); free(ptr); } From 8ce324d14f10bf682adc38bb1cdad75f09b4d6e8 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 21 Sep 2018 21:46:32 -0700 Subject: [PATCH 20/32] Add Hush --- iguana/m_notary_run | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/m_notary_run b/iguana/m_notary_run index 60aa8ff03..87c1cb604 100755 --- a/iguana/m_notary_run +++ b/iguana/m_notary_run @@ -90,6 +90,7 @@ coins/vrsc_7776 coins/rfox_7776 coins/sec_7776 coins/ccl_7776 +coins/hush_7776 #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"passthru\",\"method\":\"paxfiats\",\"timeout\":900000}" From 95beccabc30ba98d3ee828d138a587e5544c14ee Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 04:28:22 -1100 Subject: [PATCH 21/32] Prints --- iguana/exchanges/LP_utxo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 92f91e686..fc4259897 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -363,7 +363,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a //portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { - //char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d allocated.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight,LP_allocated(up->U.txid,up->U.vout)); + char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d allocated.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight,LP_allocated(up->U.txid,up->U.vout)); if ( up->spendheight <= 0 && LP_RTmetrics_avoidtxid(up->U.txid) < 0 ) { if ( coin->electrum == 0 ) @@ -372,7 +372,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a { if ( LP_value_extract(txout,0,up->U.txid) == 0 ) { -//char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str(str,up->U.txid),up->U.vout); +char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str(str,up->U.txid),up->U.vout); free_json(txout); up->spendheight = 1; if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts ) @@ -383,7 +383,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a } else { -//char str[65]; printf("LP_address_utxo_ptrs skips %s %s payment %s/v%d is spent\n",coin->symbol,coinaddr,bits256_str(str,up->U.txid),up->U.vout); +char str[65]; printf("LP_address_utxo_ptrs skips %s %s payment %s/v%d is spent\n",coin->symbol,coinaddr,bits256_str(str,up->U.txid),up->U.vout); up->spendheight = 1; if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts ) tx->outpoints[up->U.vout].spendheight = 1; @@ -394,7 +394,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a { if ( up->SPV < 0 || up->U.height == 0 ) { -//printf("LP_address_utxo_ptrs skips %s/v%u due to SPV.%d ht.%d\n",bits256_str(str,up->U.txid),up->U.vout,up->SPV,up->U.height); +printf("LP_address_utxo_ptrs skips %s/v%u due to SPV.%d ht.%d\n",bits256_str(str,up->U.txid),up->U.vout,up->SPV,up->U.height); if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts ) tx->outpoints[up->U.vout].spendheight = 1; continue; @@ -411,7 +411,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a if ( n >= max ) break; } - } //else printf("LP_allocated skip %u\n",LP_allocated(up->U.txid,up->U.vout)); + } else printf("LP_allocated skip %u\n",LP_allocated(up->U.txid,up->U.vout)); } else { @@ -420,7 +420,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a } } //portable_mutex_unlock(&LP_utxomutex); - //printf("return n.%d for %s %s\n",n,coin->symbol,coinaddr); + printf("return n.%d for %s %s\n",n,coin->symbol,coinaddr); return(n); } From 18b80e25c17aa14066186fa1962ef2ee4bb6ec1b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 04:30:54 -1100 Subject: [PATCH 22/32] Test --- iguana/exchanges/LP_utxo.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index fc4259897..aefe36f91 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -363,7 +363,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a //portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { - char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d allocated.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight,LP_allocated(up->U.txid,up->U.vout)); + //char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d allocated.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight,LP_allocated(up->U.txid,up->U.vout)); if ( up->spendheight <= 0 && LP_RTmetrics_avoidtxid(up->U.txid) < 0 ) { if ( coin->electrum == 0 ) @@ -372,7 +372,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a { if ( LP_value_extract(txout,0,up->U.txid) == 0 ) { -char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str(str,up->U.txid),up->U.vout); +//char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str(str,up->U.txid),up->U.vout); free_json(txout); up->spendheight = 1; if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts ) @@ -383,7 +383,7 @@ char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str } else { -char str[65]; printf("LP_address_utxo_ptrs skips %s %s payment %s/v%d is spent\n",coin->symbol,coinaddr,bits256_str(str,up->U.txid),up->U.vout); +//char str[65]; printf("LP_address_utxo_ptrs skips %s %s payment %s/v%d is spent\n",coin->symbol,coinaddr,bits256_str(str,up->U.txid),up->U.vout); up->spendheight = 1; if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts ) tx->outpoints[up->U.vout].spendheight = 1; @@ -394,7 +394,7 @@ char str[65]; printf("LP_address_utxo_ptrs skips %s %s payment %s/v%d is spent\n { if ( up->SPV < 0 || up->U.height == 0 ) { -printf("LP_address_utxo_ptrs skips %s/v%u due to SPV.%d ht.%d\n",bits256_str(str,up->U.txid),up->U.vout,up->SPV,up->U.height); +//printf("LP_address_utxo_ptrs skips %s/v%u due to SPV.%d ht.%d\n",bits256_str(str,up->U.txid),up->U.vout,up->SPV,up->U.height); if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts ) tx->outpoints[up->U.vout].spendheight = 1; continue; @@ -411,7 +411,7 @@ printf("LP_address_utxo_ptrs skips %s/v%u due to SPV.%d ht.%d\n",bits256_str(str if ( n >= max ) break; } - } else printf("LP_allocated skip %u\n",LP_allocated(up->U.txid,up->U.vout)); + } //else printf("LP_allocated skip %u\n",LP_allocated(up->U.txid,up->U.vout)); } else { @@ -420,7 +420,7 @@ printf("LP_address_utxo_ptrs skips %s/v%u due to SPV.%d ht.%d\n",bits256_str(str } } //portable_mutex_unlock(&LP_utxomutex); - printf("return n.%d for %s %s\n",n,coin->symbol,coinaddr); + //printf("return n.%d for %s %s\n",n,coin->symbol,coinaddr); return(n); } @@ -580,20 +580,20 @@ struct LP_address *LP_address_utxo_reset(int32_t *nump,struct iguana_info *coin) { if ( (txobj= LP_gettxout(coin->symbol,coin->smartaddr,txid,vout)) == 0 ) { -//printf("skip null gettxout %s.v%d\n",bits256_str(str,txid),vout); +printf("skip null gettxout %s.v%d\n",bits256_str(str,txid),vout); continue; } else free_json(txobj); if ( (numconfs= LP_numconfirms(coin->symbol,coin->smartaddr,txid,vout,0)) <= 0 ) { -//printf("skip numconfs.%d %s.v%d\n",numconfs,bits256_str(str,txid),vout); +printf("skip numconfs.%d %s.v%d\n",numconfs,bits256_str(str,txid),vout); continue; } } LP_address_utxoadd(1,now,"withdraw",coin,coin->smartaddr,txid,vout,value,height,-1); if ( (up= LP_address_utxofind(coin,coin->smartaddr,txid,vout)) == 0 ) { -//printf("couldnt find just added %s/%d ht.%d %.8f\n",bits256_str(str,txid),vout,height,dstr(value)); +printf("couldnt find just added %s/%d ht.%d %.8f\n",bits256_str(str,txid),vout,height,dstr(value)); } else { From d61da0d579aad9010d4c0e64e369d3407549953e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 04:40:08 -1100 Subject: [PATCH 23/32] Test --- iguana/exchanges/LP_utxo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index aefe36f91..54dac09cf 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -464,7 +464,7 @@ int32_t LP_address_utxoadd(int32_t skipsearch,uint32_t timestamp,char *debug,str if ( spendheight > 0 ) // dont autocreate entries for spends we dont care about ap = LP_addressfind(coin,coinaddr); else ap = LP_address(coin,coinaddr); - //printf("%s add addr.%s ht.%d ap.%p\n",coin->symbol,coinaddr,height,ap); + //printf("skipflag.%d %s add addr.%s ht.%d ap.%p\n",skipsearchcoin->symbol,coinaddr,height,ap); if ( ap != 0 ) { flag = 0; @@ -500,7 +500,7 @@ int32_t LP_address_utxoadd(int32_t skipsearch,uint32_t timestamp,char *debug,str { if ( (hexstr= jstr(sobj,"hex")) != 0 ) { - if ( strlen(hexstr) != 25*2 ) + if ( strlen(hexstr) != 25*2 && strlen(hexstr) != 35*2 ) { //printf("skip non-standard utxo.(%s)\n",hexstr); free_json(txobj); From 3e82a14ef0ed70a34cfc04380c7cf96b30f7e75a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 04:56:05 -1100 Subject: [PATCH 24/32] Test --- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_transaction.c | 6 ++++-- iguana/exchanges/LP_utxo.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index dbb46e4f1..e2549d4de 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -321,7 +321,7 @@ struct iguana_info bits256 cachedmerkle,notarizedhash; int32_t cachedmerkleheight; }; -struct _LP_utxoinfo { bits256 txid; uint64_t value; int32_t vout,height; }; +struct _LP_utxoinfo { bits256 txid; uint64_t value; int32_t vout:30,suppress:1,pad:1,height; }; struct LP_utxostats { uint32_t sessionid,lasttime,errors,swappending,spentflag,lastspentcheck,bestflag; }; diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index a58b4ae4a..d82393978 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1059,7 +1059,7 @@ int64_t LP_komodo_interest(bits256 txid,int64_t value) int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_t amount,struct vin_info *V,struct LP_address_utxo **utxos,int32_t numunspents,int32_t suppress_pubkeys,int32_t ignore_cltverr,bits256 privkey,cJSON *privkeys,cJSON *vins,uint8_t *script,int32_t scriptlen,bits256 utxotxid,int32_t utxovout,int32_t dustcombine) { - char wifstr[128],spendscriptstr[128],str[65]; int32_t i,j,maxiters,n,numpre,ind,abovei,belowi,maxmode=0; struct vin_info *vp; cJSON *txobj; struct LP_address_utxo *up,*min0,*min1,*preselected[3]; int64_t value,interest,interestsum,above,below,remains = amount,total = 0; + char wifstr[128],spendscriptstr[128],str[65]; int32_t i,j,maxiters,n,numpre,ind,abovei,belowi,maxmode=0; struct vin_info *vp; cJSON *txobj,*sobj; struct LP_address_utxo *up,*min0,*min1,*preselected[3]; int64_t value,interest,interestsum,above,below,remains = amount,total = 0; *totalp = 0; interestsum = 0; init_hexbytes_noT(spendscriptstr,script,scriptlen); @@ -1083,6 +1083,8 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ { up->spendheight = 1; utxos[j] = 0; + if ( (sobj= jstr(txobj,"scriptPubKey")) != 0 && jstr(sobj,"hex") != 0 && strlen(jstr(sobj,"hex")) == 35*2 ) + up->suppress = 1; } else { @@ -1211,7 +1213,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ vp->signers[0].privkey = privkey; jaddistr(privkeys,wifstr); bitcoin_pubkey33(ctx,vp->signers[0].pubkey,privkey); - vp->suppress_pubkeys = suppress_pubkeys; + vp->suppress_pubkeys = up->suppress; vp->ignore_cltverr = ignore_cltverr; jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr)); LP_unavailableset(up->U.txid,up->U.vout,(uint32_t)time(NULL)+LP_RESERVETIME*2,G.LP_mypub25519); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 54dac09cf..d6119c028 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -580,20 +580,20 @@ struct LP_address *LP_address_utxo_reset(int32_t *nump,struct iguana_info *coin) { if ( (txobj= LP_gettxout(coin->symbol,coin->smartaddr,txid,vout)) == 0 ) { -printf("skip null gettxout %s.v%d\n",bits256_str(str,txid),vout); +//printf("skip null gettxout %s.v%d\n",bits256_str(str,txid),vout); continue; } else free_json(txobj); if ( (numconfs= LP_numconfirms(coin->symbol,coin->smartaddr,txid,vout,0)) <= 0 ) { -printf("skip numconfs.%d %s.v%d\n",numconfs,bits256_str(str,txid),vout); +//printf("skip numconfs.%d %s.v%d\n",numconfs,bits256_str(str,txid),vout); continue; } } LP_address_utxoadd(1,now,"withdraw",coin,coin->smartaddr,txid,vout,value,height,-1); if ( (up= LP_address_utxofind(coin,coin->smartaddr,txid,vout)) == 0 ) { -printf("couldnt find just added %s/%d ht.%d %.8f\n",bits256_str(str,txid),vout,height,dstr(value)); +//printf("couldnt find just added %s/%d ht.%d %.8f\n",bits256_str(str,txid),vout,height,dstr(value)); } else { From 77a485568b520238377db84ed6f6e0a25d861629 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 04:58:28 -1100 Subject: [PATCH 25/32] Test --- iguana/exchanges/LP_transaction.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index d82393978..d5ba1c235 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1083,8 +1083,8 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ { up->spendheight = 1; utxos[j] = 0; - if ( (sobj= jstr(txobj,"scriptPubKey")) != 0 && jstr(sobj,"hex") != 0 && strlen(jstr(sobj,"hex")) == 35*2 ) - up->suppress = 1; + if ( (sobj= jobj(txobj,"scriptPubKey")) != 0 && jstr(sobj,"hex") != 0 && strlen(jstr(sobj,"hex")) == 35*2 ) + up->U.suppress = 1; } else { @@ -1213,7 +1213,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ vp->signers[0].privkey = privkey; jaddistr(privkeys,wifstr); bitcoin_pubkey33(ctx,vp->signers[0].pubkey,privkey); - vp->suppress_pubkeys = up->suppress; + vp->suppress_pubkeys = up->U.suppress; vp->ignore_cltverr = ignore_cltverr; jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr)); LP_unavailableset(up->U.txid,up->U.vout,(uint32_t)time(NULL)+LP_RESERVETIME*2,G.LP_mypub25519); From f54c05e43d9f21168d75e4087553fb4ec5007039 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 05:04:53 -1100 Subject: [PATCH 26/32] Test --- iguana/exchanges/LP_utxo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index d6119c028..b0fe8dd2e 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -357,7 +357,7 @@ int32_t LP_address_minmax(int32_t iambob,uint64_t *medianp,uint64_t *minp,uint64 int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_address_utxo **utxos,int32_t max,struct LP_address *ap,char *coinaddr) { - struct LP_address_utxo *up,*tmp; struct LP_transaction *tx; cJSON *txout; int32_t i,n = 0; + struct LP_address_utxo *up,*tmp; struct LP_transaction *tx; cJSON *txout,*sobj; int32_t i,n = 0; if ( strcmp(ap->coinaddr,coinaddr) != 0 ) printf("UNEXPECTED coinaddr mismatch (%s) != (%s)\n",ap->coinaddr,coinaddr); //portable_mutex_lock(&LP_utxomutex); @@ -370,6 +370,9 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a { if ( (txout= LP_gettxout(coin->symbol,coinaddr,up->U.txid,up->U.vout)) != 0 ) { + printf("check sobj.hex %s\n",jprint(txout,0)); + if ( (sobj= jobj(txout,"scriptPubKey")) != 0 && jstr(sobj,"hex") != 0 && strlen(jstr(sobj,"hex")) == 35*2 ) + up->U.suppress = 1; if ( LP_value_extract(txout,0,up->U.txid) == 0 ) { //char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str(str,up->U.txid),up->U.vout); From 069b2a3671b84fe7e79565528e280bea8411603f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 05:07:20 -1100 Subject: [PATCH 27/32] Test --- iguana/exchanges/LP_utxo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index b0fe8dd2e..bb825e1c4 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -370,9 +370,12 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a { if ( (txout= LP_gettxout(coin->symbol,coinaddr,up->U.txid,up->U.vout)) != 0 ) { - printf("check sobj.hex %s\n",jprint(txout,0)); + //printf("check sobj.hex %s\n",jprint(txout,0)); if ( (sobj= jobj(txout,"scriptPubKey")) != 0 && jstr(sobj,"hex") != 0 && strlen(jstr(sobj,"hex")) == 35*2 ) + { up->U.suppress = 1; + printf("suppress %s\n",jprint(sobj,0)); + } if ( LP_value_extract(txout,0,up->U.txid) == 0 ) { //char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str(str,up->U.txid),up->U.vout); From 3eb69b1aaaa8ecd3ffd13748dd78c6cab9704c7e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 05:10:31 -1100 Subject: [PATCH 28/32] Test --- iguana/exchanges/LP_transaction.c | 2 ++ iguana/exchanges/LP_utxo.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index d5ba1c235..23e13de24 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1214,6 +1214,8 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ jaddistr(privkeys,wifstr); bitcoin_pubkey33(ctx,vp->signers[0].pubkey,privkey); vp->suppress_pubkeys = up->U.suppress; + if ( vp->suppress_pubkeys != 0 ) + printf("suppress vin.%d\n",n); vp->ignore_cltverr = ignore_cltverr; jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr)); LP_unavailableset(up->U.txid,up->U.vout,(uint32_t)time(NULL)+LP_RESERVETIME*2,G.LP_mypub25519); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index bb825e1c4..4b807865a 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -374,7 +374,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a if ( (sobj= jobj(txout,"scriptPubKey")) != 0 && jstr(sobj,"hex") != 0 && strlen(jstr(sobj,"hex")) == 35*2 ) { up->U.suppress = 1; - printf("suppress %s\n",jprint(sobj,0)); + //printf("suppress %s\n",jprint(sobj,0)); } if ( LP_value_extract(txout,0,up->U.txid) == 0 ) { From 3acddebcdb240d123d5a6f2229da23d1e50faa3a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 05:13:16 -1100 Subject: [PATCH 29/32] Test --- iguana/exchanges/LP_transaction.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 23e13de24..19ef8bf70 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1451,6 +1451,7 @@ char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_inf return(0); } } + printf("suppress.%d\n",V->suppress_pubkeys); if ( (rawtxbytes= bitcoin_json2hex(coin->symbol,coin->isPoS,&txid,txobj,V)) != 0 ) { } else printf("error making rawtx suppress.%d\n",suppress_pubkeys); From c0a4989b75107d3a5c9bdac089d67f874af5bdc7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 05:15:25 -1100 Subject: [PATCH 30/32] Test --- iguana/exchanges/LP_include.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index e2549d4de..0b0ff0da7 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -321,7 +321,7 @@ struct iguana_info bits256 cachedmerkle,notarizedhash; int32_t cachedmerkleheight; }; -struct _LP_utxoinfo { bits256 txid; uint64_t value; int32_t vout:30,suppress:1,pad:1,height; }; +struct _LP_utxoinfo { bits256 txid; uint64_t value; int32_t height; uint32_t vout:30,suppress:1,pad:1; }; struct LP_utxostats { uint32_t sessionid,lasttime,errors,swappending,spentflag,lastspentcheck,bestflag; }; From 848e32e0064ebfed0ab3793902a6ded16f5ecdfa Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 05:19:40 -1100 Subject: [PATCH 31/32] Test --- iguana/exchanges/LP_transaction.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 19ef8bf70..c11255958 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -999,11 +999,13 @@ int32_t LP_vin_select(int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t //return(abovei >= 0 && above < (below>>1) ? abovei : belowi); } -cJSON *LP_inputjson(bits256 txid,int32_t vout,char *spendscriptstr) +cJSON *LP_inputjson(bits256 txid,int32_t vout,char *spendscriptstr,int32_t suppress) { cJSON *sobj,*item = cJSON_CreateObject(); jaddbits256(item,"txid",txid); jaddnum(item,"vout",vout); + if ( suppress != 0 ) + jaddum(item,"suppress",1); sobj = cJSON_CreateObject(); jaddstr(sobj,"hex",spendscriptstr); jadd(item,"scriptPubKey",sobj); @@ -1214,10 +1216,8 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ jaddistr(privkeys,wifstr); bitcoin_pubkey33(ctx,vp->signers[0].pubkey,privkey); vp->suppress_pubkeys = up->U.suppress; - if ( vp->suppress_pubkeys != 0 ) - printf("suppress vin.%d\n",n); vp->ignore_cltverr = ignore_cltverr; - jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr)); + jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr,up->U.suppress)); LP_unavailableset(up->U.txid,up->U.vout,(uint32_t)time(NULL)+LP_RESERVETIME*2,G.LP_mypub25519); if ( remains <= 0 && i >= numpre-1 ) break; @@ -1451,7 +1451,7 @@ char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_inf return(0); } } - printf("suppress.%d\n",V->suppress_pubkeys); + //printf("suppress.%d\n",V->suppress_pubkeys); if ( (rawtxbytes= bitcoin_json2hex(coin->symbol,coin->isPoS,&txid,txobj,V)) != 0 ) { } else printf("error making rawtx suppress.%d\n",suppress_pubkeys); @@ -1601,7 +1601,7 @@ char *LP_createblasttransaction(uint64_t *changep,int32_t *changeoutp,cJSON **tx scriptlen = bitcoin_standardspend(script,0,rmd160); init_hexbytes_noT(spendscriptstr,script,scriptlen); vins = cJSON_CreateArray(); - jaddi(vins,LP_inputjson(utxotxid,utxovout,spendscriptstr)); + jaddi(vins,LP_inputjson(utxotxid,utxovout,spendscriptstr,suppress_pubkeys)); jdelete(txobj,"vin"); jadd(txobj,"vin",jduplicate(vins)); *vinsp = vins; From 8b4cb154c879fc852f97cad9afc5763f5865e522 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Sep 2018 05:20:26 -1100 Subject: [PATCH 32/32] Test --- iguana/exchanges/LP_transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index c11255958..76539117b 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1005,7 +1005,7 @@ cJSON *LP_inputjson(bits256 txid,int32_t vout,char *spendscriptstr,int32_t suppr jaddbits256(item,"txid",txid); jaddnum(item,"vout",vout); if ( suppress != 0 ) - jaddum(item,"suppress",1); + jaddnum(item,"suppress",1); sobj = cJSON_CreateObject(); jaddstr(sobj,"hex",spendscriptstr); jadd(item,"scriptPubKey",sobj);