add zero_conf option to get_outputs

This commit is contained in:
cryptochangements34 2018-06-08 23:16:53 -05:00 committed by GitHub
parent b30ee78993
commit 4cbcde5e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -366,14 +366,27 @@ class NodeTools
return $array['data']['txs'];
}
public function get_outputs($address, $viewkey)
public function get_outputs($address, $viewkey, $zero_conf = false)
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $this->url . '/api/outputsblocks?address=' . $address . '&viewkey=' . $viewkey . '&limit=5&mempool=0',
));
if(!$zero_conf)
{
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $this->url . '/api/outputsblocks?address=' . $address . '&viewkey=' . $viewkey . '&limit=5&mempool=0',
));
}
// also look in mempool if accepting zero confirmation transactions
if($zero_conf)
{
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $this->url . '/api/outputsblocks?address=' . $address . '&viewkey=' . $viewkey . '&limit=5&mempool=1',
));
}
$resp = curl_exec($curl);
curl_close($curl);