Page MenuHomePhabricator

Implement EBx indicator in coinbase message
ClosedPublic

Authored by sickpig on Jun 22 2017, 14:55.

Details

Summary

Implement EBx indicator in coinbase message

Test Plan

src/test/test_bitcoin -t miner_tests

Diff Detail

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

Event Timeline

src/validation.cpp
541 ↗(On Diff #623)

left over, will remove on the next iteration

deadalnix requested changes to this revision.Jun 22 2017, 15:09

Use the plan change feature when you plan to change something.

This revision now requires changes to proceed.Jun 22 2017, 15:09
src/miner.cpp
108 ↗(On Diff #623)

This is introducing extra global state.

Need to polish some left over and address @deadalnix feedback

sickpig edited edge metadata.

Don't overwrite COINBASE_FLAG
avoid to introduce a new global state, read EB every time we need it
remove a left over from validation.cpp

deadalnix requested changes to this revision.Jun 22 2017, 16:40
deadalnix added inline comments.
src/miner.cpp
81 ↗(On Diff #628)

Return the vector directly and move near to where it is called. Make it static.

201 ↗(On Diff #628)

This change is not necessary. The merkle root is not computed anyway. You have to call IncrementExtraNonce .

src/miner.h
18 ↗(On Diff #628)

Declare in the cpp file.

227 ↗(On Diff #628)

Remove.

src/test/miner_tests.cpp
207 ↗(On Diff #628)

The chain params are in the config.

220 ↗(On Diff #628)

You don't need to copy the coinbase.

225 ↗(On Diff #628)

Empty lines are free.

src/test/test_bitcoin.cpp
131 ↗(On Diff #628)

No GetConfig here. The whole point of creating a config object is to get rid of global state, not add more.

This revision now requires changes to proceed.Jun 22 2017, 16:40
sickpig edited edge metadata.

change return type of getExcessiveBlockSizeSig
check for coinbase message only agter IncrementExtraNonce has been called

src/miner.cpp
135 ↗(On Diff #633)

Make it static.

201 ↗(On Diff #633)

Revert these 2 lines.

src/miner.h
18 ↗(On Diff #633)

Declare in the cpp file.

227 ↗(On Diff #633)

Remove.

sickpig added inline comments.
src/miner.cpp
201 ↗(On Diff #633)

parenthesis?

81 ↗(On Diff #628)

done

201 ↗(On Diff #628)

removed

src/miner.h
227 ↗(On Diff #633)
CXX      test/test_test_bitcoin-miner_tests.o

test/miner_tests.cpp: In member function ‘void miner_tests::CheckCoinbase_EB::test_method()’:
test/miner_tests.cpp:226:123: error: ‘getExcessiveBlockSizeSig’ was not declared in this scope
Makefile:8422: recipe for target 'test/test_test_bitcoin-miner_tests.o' failed

src/test/miner_tests.cpp
207 ↗(On Diff #628)

done

220 ↗(On Diff #628)

done

225 ↗(On Diff #628)

added

src/miner.h
18 ↗(On Diff #633)

This is clearly not done :)

src/test/miner_tests.cpp
228 ↗(On Diff #633)

Here you should use the value you expect. If not you are just testing that calling getExcessiveBlockSizeSig gives you the same result twice, but not that the results makes any sense whatsoever.

src/test/test_bitcoin.cpp
120 ↗(On Diff #633)

This changes nothing. You are still pulling config from the global state. Pass it down.

deadalnix requested changes to this revision.Jun 22 2017, 19:38
This revision now requires changes to proceed.Jun 22 2017, 19:38
sickpig edited edge metadata.

mv MAX_COINBASE_SCRIPTSIG_SIZE to miner.cpp
remove decaration of getExcessiveBlockSizeSig from miner.h
make getExcessiveBlockSizeSig static
Expand the coinbase message test

deadalnix added inline comments.
src/miner.cpp
36 ↗(On Diff #645)

static

This revision is now accepted and ready to land.Jun 22 2017, 21:56

declare MAX_COINBASE_SCRIPTSIG_SIZE static

This revision was automatically updated to reflect the committed changes.