def test_islock_overrides_nonchainlock(self):
    rawtx1 = self.create_raw_tx(self.nodes[0], self.nodes[0], 1, 1, 100)['hex']
    rawtx2 = self.create_raw_tx(self.nodes[0], self.nodes[0], 1, 1, 100)['hex']
    rawtx1_txid = encode(hash256(hex_str_to_bytes(rawtx1))[::(- 1)], 'hex_codec').decode('ascii')
    rawtx2_txid = encode(hash256(hex_str_to_bytes(rawtx2))[::(- 1)], 'hex_codec').decode('ascii')
    islock = self.create_islock(rawtx2)
    for i in range(3):
        self.stop_node((len(self.nodes) - 1))
        self.nodes.pop((len(self.nodes) - 1))
        self.mninfo.pop((len(self.mninfo) - 1))
    self.nodes[0].sendrawtransaction(rawtx1)
    set_mocktime((get_mocktime() + int((60 * 11))))
    set_node_times(self.nodes, get_mocktime())
    good_tip = self.nodes[0].getbestblockhash()
    self.nodes[0].generate(2)
    self.sync_all()
    assert (self.nodes[0].getrawtransaction(rawtx1_txid, True)['confirmations'] > 0)
    assert_raises_jsonrpc((- 25), 'Missing inputs', self.nodes[0].sendrawtransaction, rawtx2)
    self.test_node.send_islock(islock)
    sleep(5)
    assert (self.nodes[0].getbestblockhash() == good_tip)
    assert (self.nodes[1].getbestblockhash() == good_tip)
    self.nodes[0].sendrawtransaction(rawtx2)
    self.nodes[0].generate(1)
    self.sync_all()
    assert (self.nodes[0].getrawtransaction(rawtx2_txid, True)['confirmations'] > 0)
    assert (self.nodes[1].getrawtransaction(rawtx2_txid, True)['confirmations'] > 0)
    assert self.nodes[0].getrawtransaction(rawtx2_txid, True)['instantlock']
    assert self.nodes[1].getrawtransaction(rawtx2_txid, True)['instantlock']
    assert (self.nodes[0].getbestblockhash() != good_tip)
    assert (self.nodes[1].getbestblockhash() != good_tip)
def test_islock_overrides_nonchainlock(self):
    rawtx1 = self.create_raw_tx(self.nodes[0], self.nodes[0], 1, 1, 100)['hex']
    rawtx2 = self.create_raw_tx(self.nodes[0], self.nodes[0], 1, 1, 100)['hex']
    rawtx1_txid = encode(hash256(hex_str_to_bytes(rawtx1))[::(- 1)], 'hex_codec').decode('ascii')
    rawtx2_txid = encode(hash256(hex_str_to_bytes(rawtx2))[::(- 1)], 'hex_codec').decode('ascii')
    islock = self.create_islock(rawtx2)
    for i in range(3):
        self.stop_node((len(self.nodes) - 1))
        self.nodes.pop((len(self.nodes) - 1))
        self.mninfo.pop((len(self.mninfo) - 1))
    self.nodes[0].sendrawtransaction(rawtx1)
    set_mocktime((get_mocktime() + int((60 * 11))))
    set_node_times(self.nodes, get_mocktime())
    good_tip = self.nodes[0].getbestblockhash()
    self.nodes[0].generate(2)
    self.sync_all()
    assert (self.nodes[0].getrawtransaction(rawtx1_txid, True)['confirmations'] > 0)
    assert_raises_jsonrpc((- 25), 'Missing inputs', self.nodes[0].sendrawtransaction, rawtx2)
    self.test_node.send_islock(islock)
    sleep(5)
    assert (self.nodes[0].getbestblockhash() == good_tip)
    assert (self.nodes[1].getbestblockhash() == good_tip)
    self.nodes[0].sendrawtransaction(rawtx2)
    self.nodes[0].generate(1)
    self.sync_all()
    assert (self.nodes[0].getrawtransaction(rawtx2_txid, True)['confirmations'] > 0)
    assert (self.nodes[1].getrawtransaction(rawtx2_txid, True)['confirmations'] > 0)
    assert self.nodes[0].getrawtransaction(rawtx2_txid, True)['instantlock']
    assert self.nodes[1].getrawtransaction(rawtx2_txid, True)['instantlock']
    assert (self.nodes[0].getbestblockhash() != good_tip)
    assert (self.nodes[1].getbestblockhash() != good_tip)