Teach RPC interface about dpow-enabled minconfs (#1231)

* Make minconfs dpow-aware in z_listunspent + z_listreceivedbyaddress

* Add dpow-related test files to test suite

* Add dpow simulation to regtest every 7 blocks

* Fix compiler errors

* Fix link error

* Fix stdout spam when running regtests

* Dpowminconfs for listreceivedbyaddress

* dpowconfs tests

* Start adding specific tests for dpowminconfs in listreceivedbyaddress

* Get dpowminconfs tests for listreceivedbyaddress working

* Add dpowminconfs to getreceivedbyaddress + listunspent

* Add test for listtransactions + getreceivedbyaddress support

* Reliably passing dpowminconf tests. We only check for notarized-ness now, not exact confirmation numbers, to avoid race conditions

* Poll for the expected notarization info before running further tests; add support for getbalance

* Migrate tx_height() to a place where asyncrpcoperation_sendmany.cpp can use it

* fix

* Teach GetFilteredNotes about dpowconfs

Many RPCs rely on this internal function, which now correctly uses
dpowconfs to filter by the minconf/maxconf parameters.

* Fix sendmany when using non-default minconf

* inline seems to make things happy

* cleanup

* Add some code to test z_sendmany, which points out https://github.com/jl777/komodo/issues/1247

* try this

* Use already calculated value of dpowconfs instead of calculating it again
This commit is contained in:
Duke Leto
2019-03-03 18:27:50 -05:00
committed by jl777
parent 5cb774d1fe
commit c99801952b
12 changed files with 324 additions and 98 deletions

View File

@@ -54,6 +54,8 @@ using namespace libzcash;
extern char ASSETCHAINS_SYMBOL[65];
int32_t komodo_dpowconfs(int32_t height,int32_t numconfs);
int tx_height( const uint256 &hash );
extern UniValue signrawtransaction(const UniValue& params, bool fHelp);
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp);
@@ -1049,8 +1051,16 @@ bool AsyncRPCOperation_sendmany::find_utxos(bool fAcceptCoinbase=false) {
continue;
}
if (out.nDepth < mindepth_) {
continue;
if( mindepth_ > 1 ) {
int nHeight = tx_height(out.tx->GetHash());
int dpowconfs = komodo_dpowconfs(nHeight, out.nDepth);
if (dpowconfs < mindepth_) {
continue;
}
} else {
if (out.nDepth < mindepth_) {
continue;
}
}
const CScript &scriptPubKey = out.tx->vout[out.i].scriptPubKey;