2

I built a private testnet with reference to this guide.

In order to understand how the secret transaction key is generated, I examined how many times the open_tx function (in device_default.cpp) was executed with a transfer command from the monero-wallet-cli. open_tx is the function used in construct_tx_and_get_tx_key function (in cryptonote_tx_utils.cpp) to generate a secret transaction key.

It turned out that open_tx was executed twice per one transfer command. Why is open_tx executed twice instead of once?

jtgrassie
  • 19,601
  • 4
  • 17
  • 54
remiremy
  • 41
  • 1

1 Answers1

2

In short, tests.

You can see this by following the path taken by the CLI wallet when doing a transfer, as you essentially end up in create_transactions_2. If you follow through that, you will see transfer_selected_rct gets called from various places (1/2 & 3), and it's that which makes calls through to open_tx via construct_tx_and_get_tx_key. Thus a test tx performed in create_transactions_2 will call through to open_tx, as will the final real one.

jtgrassie
  • 19,601
  • 4
  • 17
  • 54