Page MenuHomePhabricator

[BroadcastTransaction] Remove unsafe move operator
ClosedPublic

Authored by PiRK on Nov 15 2021, 08:22.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC1822d571b6fd: [BroadcastTransaction] Remove unsafe move operator
Summary

Previously, tx was being read after having std::move called on it. The
std::move operator indicates to the compiler that this object may be "moved
from", so we shouldn't subsequently read from it. The current code is not
problematic since tx is passed in as a const ref. But this std::move is at
best misleading & at worst problematic, so remove it.

This is a backport of core#19879
https://github.com/bitcoin/bitcoin/pull/19879/commits/a8a64acaf32ac21feeb885671772282b531ef9a2

The other commits of that pull request are not relevant, as they deal with segwit issues.
This missing backport was noticed in the review of D10464, which adds a use of tx after move.

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Nov 15 2021, 08:22
PiRK retitled this revision from BroadcastTransaction] Remove unsafe move operator to [:wqBroadcastTransaction] Remove unsafe move operator.Nov 15 2021, 09:42
PiRK retitled this revision from [:wqBroadcastTransaction] Remove unsafe move operator to [BroadcastTransaction] Remove unsafe move operator.
This revision is now accepted and ready to land.Nov 16 2021, 14:09