Ejemplo n.º 1
0
         }
     }
 }
 if ($claim_code == $code && $reason == $original_reason) {
     $api = new bs_api();
     $address_obj = $api->address(array('id' => $addresses[$chain], 'chain' => $chain));
     $fee = $fees[$chain] * 100000000;
     $amount_to_send = $fee * 3;
     if ($sent) {
         $amount_to_send = $sent;
     }
     if (is_array($address_obj) && isset($address_obj['balance']) && $address_obj['balance'] >= $amount_to_send) {
         if (isset($keys[$chain]) && $tx) {
             try {
                 $bitcoin = new Bitcoin($usernames[$chain], $passwords[$chain], $hosts[$chain], $ports[$chain]);
                 $decoded_tx = $bitcoin->decoderawtransaction($tx);
                 if (isset($decoded_tx['vout']) && isset($decoded_tx['vout'][1]) && isset($decoded_tx['vout'][1]['scriptPubKey']) && isset($decoded_tx['vout'][1]['scriptPubKey']['addresses']) && isset($decoded_tx['vout'][1]['scriptPubKey']['addresses'][0])) {
                     $return_address = $decoded_tx['vout'][1]['scriptPubKey']['addresses'][0];
                 } else {
                 }
                 if ($return_address != $addresses[$chain]) {
                     $results['msg'] = '<p><strong>That\'s naughty!</strong> Changing the return address is not allowed.</p>';
                     $results['msg'] .= '<p>We would be interested in discussing the possibility of working with you though.</p>';
                     $results['msg'] .= '<p>Please get in touch if you have any interest in being paid for this kind of thing.</p>';
                 } else {
                     $bitcoin = new Bitcoin($usernames[$chain], $passwords[$chain], $hosts[$chain], $ports[$chain]);
                     $outputs = null;
                     $keys = [$keys[$chain]];
                     $raw_tx_results = $bitcoin->signrawtransaction($tx, $outputs, $keys);
                     if (is_array($raw_tx_results) && isset($raw_tx_results['hex'])) {
                         $raw_tx = $raw_tx_results['hex'];