Confirm transaction in regtest mode

0

I'm testing some wallet features on regtest. Here's the sequence so far:

cash-cli -regtest generate 101
cash-cli -regtest getbalance
500.00000000

cash-cli -regtest getnewaddress newAddress1
yeAPxkjsNk5RZnAyfHM6cjCtKM7oRUvhzX

cash-cli -regtest  sendtoaddress getrawtransaction 148b8ced78037cb8fe3b32b8814dbf6736c144448671a86da548bbdb5670750a 1
//...
{
      "value": 2.00000000,
      "valueSat": 200000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 c3bc1c481a15343ceb27d45d950c8770b7a0be1c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914c3bc1c481a15343ceb27d45d950c8770b7a0be1c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "yeAPxkjsNk5RZnAyfHM6cjCtKM7oRUvhzX"
        ]
      }
    }, 
//...

dash-cli -regtest gettxout 148b8ced78037cb8fe3b32b8814dbf6736c144448671a86da548bbdb5670750a 0 false
//returns nothing as the transaction is not confirmed. Returns result if we change flag to true

How do I set transaction as confirmed in regtest mode so that dash-cli -regtest <txid> <outid> false would return the transaction output as a valid one?

Ben

Posted 2018-08-27T13:18:57.120

Reputation: 113

Answers

1

A transaction is confirmed by including it in a block. This means that you have to mine a block which includes the transaction. You can do this using the generate command.

Andrew Chow

Posted 2018-08-27T13:18:57.120

Reputation: 40 910

I create and send raw transaction then use generatetoaddress to mine blocks to get confirmations but the sent transactions stays unconfirmed. Any idea why?Fontaine 2019-09-19T03:42:34.660

could you give me an example?Ben 2018-08-27T13:31:49.353

cash-cli -regtest generate 6 will create 6 blocks with the block reward going to your wallet.Andrew Chow 2018-08-27T13:35:55.003