Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

If one used generate while running with multiple wallets -wallet=file1.dat wallet=file2.dat the wallet used for the coinbase script is pretty undefined (or lets say weak defined, it's probably always the last one).

This PR is a quick fix (should be okay for the internal miner) to ensure we always use the first wallet for generate | setgenerate.

Ideally, someone works on passing the endpoint (coming soon) down to the signal listener.

@laanwj
Copy link
Member

laanwj commented Jun 22, 2017

I proposed this before but not sure what the outcome of the discussion was - what about making generate a wallet method?
This means Instead of using the first wallet, could simply use GetWalletForJSONRPCRequest(request).
(edit: apparently I proposed this in #7965)

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK b43a646. This is a good fix for current unpredictable behavior. It's hard to write python tests that depend on multiwallet without this.

I proposed this before but not sure what the outcome of the discussion was - what about making generate a wallet method?

Seems like a good idea. Would you lose the ability to generate blocks when wallet is disabled (if we even have this ability)?

@laanwj
Copy link
Member

laanwj commented Jun 24, 2017

Seems like a good idea. Would you lose the ability to generate blocks when wallet is disabled (if we even have this ability)?

No-

  • generatetoaddress will work without wallet
  • generate needs wallet

See #10683.

@jnewbery
Copy link
Contributor

I think #10683 is a better solution here.

@laanwj
Copy link
Member

laanwj commented Jun 28, 2017

Closing in favor of #10683

@laanwj laanwj closed this Jun 28, 2017
laanwj added a commit to laanwj/bitcoin that referenced this pull request Jun 29, 2017
This makes it possible to mine to any wallet when multi-wallet mode is added.
Solves the same problem as bitcoin#10649, but IMO in a cleaner way.

It also gets rid of the circuitous `ScriptForMining` method on
`CValidationInterface`, which really doesn't belong there.

After this change it's still possible to mine without wallet through
`generatetoaddress`.
HashUnlimited pushed a commit to chaincoin/chaincoin that referenced this pull request Mar 6, 2018
This makes it possible to mine to any wallet when multi-wallet mode is added.
Solves the same problem as bitcoin#10649, but IMO in a cleaner way.

It also gets rid of the circuitous `ScriptForMining` method on
`CValidationInterface`, which really doesn't belong there.

After this change it's still possible to mine without wallet through
`generatetoaddress`.

Conflicts:
	src/rpc/mining.cpp
	src/rpc/mining.h
	src/validationinterface.cpp
	src/validationinterface.h
	src/wallet/rpcwallet.cpp
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants