Skip to content

[rpc] AsyncRPCOperation: Constructor takes std::shared_ptr<CWallet>#32

Open
ch4ot1c wants to merge 2 commits into
BTCPrivate:masterfrom
ch4ot1c:improvement/AsyncRPCOperation-ctor
Open

[rpc] AsyncRPCOperation: Constructor takes std::shared_ptr<CWallet>#32
ch4ot1c wants to merge 2 commits into
BTCPrivate:masterfrom
ch4ot1c:improvement/AsyncRPCOperation-ctor

Conversation

@ch4ot1c
Copy link
Copy Markdown
Contributor

@ch4ot1c ch4ot1c commented Jul 12, 2018

This is the better define the lifecycle and ownership model of AsyncRPCOperation and CWallets.

Also, pwalletMain->pwallet_.

@donshin donshin requested review from donshin and michaelotis July 13, 2018 05:55
Copy link
Copy Markdown
Contributor

@michaelotis michaelotis left a comment

Choose a reason for hiding this comment

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

Good use of shared_ptr to allow for wallet object destruction

Copy link
Copy Markdown
Contributor

@jc23424 jc23424 left a comment

Choose a reason for hiding this comment

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

I think best to follow these style guidelines going forward https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md

so m_pwallet instead of pwallet_

Comment thread src/asyncrpcoperation.cpp
@@ -44,6 +48,7 @@ AsyncRPCOperation::AsyncRPCOperation(const AsyncRPCOperation& o) :
}

AsyncRPCOperation& AsyncRPCOperation::operator=( const AsyncRPCOperation& other ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this doesn't really feel like something that should be copy assignable - i.e. what happens if i take a copy and cancel the copy?

it should be move assignable - but i don't see any reason why the default move assignment wouldn't work. if you just delete this operator and replace any assignments with a move?

i.e. AsyncRPCOperation x = y; becomes AsyncRPCOperation x = std::move(y)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good insight; agreed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ref #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants