Skip to content

Conversation

@tonypizzicato
Copy link
Member

No description provided.

@tonypizzicato tonypizzicato self-assigned this Aug 21, 2017
@tonypizzicato tonypizzicato changed the base branch from feature/referral-model to master August 24, 2017 20:35
leaves[s] = block.vref[s]->GetHash();
}
for (size_t s = 0; s < block.m_vRef.size(); s++) {
leaves[block.vtx.size() + s] = block.m_vRef[s]->GetHash();
Copy link
Member

Choose a reason for hiding this comment

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

woops!

}
pto->vInventoryBlockToSend.clear();


Copy link
Member

Choose a reason for hiding this comment

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

I would put this bit in its own function. this one is big enough.


// Add referrals
for (const uint256& hash : pto->setInventoryReferralToSend) {
vInv.push_back(CInv(MSG_REFERRAL, hash));
Copy link
Member

Choose a reason for hiding this comment

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

is this only place vInv is pushed to? might want >= below

Copy link
Member Author

Choose a reason for hiding this comment

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

didn't get it

nVersion{Referral::CURRENT_VERSION},
previousReferral{},
scriptSig{},
code{GetRandHash()} {}
Copy link
Member

Choose a reason for hiding this comment

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

are we going to support non rand codes in future? then this makes sense. otherwise code can be hash of the referral itself

Copy link
Member Author

Choose a reason for hiding this comment

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

hash of the referral is not random. it's just a hash of referral object. in case we use the same referral as previousReferral we can get the same hash. on the other hand scriptSig can help here as we likely would use unique pubkey for signing. but not sure yet how signature works.
the second point is that we can use hash of generated random code to store it in the blockchain to make it opaque for outsiders.

src/protocol.cpp Outdated
NetMsgType::GETBLOCKTXN,
NetMsgType::BLOCKTXN,
// Merit messages go below
NetMsgType::REF,
Copy link
Member

Choose a reason for hiding this comment

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

indenting...

src/protocol.h Outdated
// The following can only occur in getdata. Invs always use TX or BLOCK.
MSG_FILTERED_BLOCK = 3, //!< Defined in BIP37
MSG_CMPCT_BLOCK = 4, //!< Defined in BIP152
MSG_REFERRAL = 5,
Copy link
Member

Choose a reason for hiding this comment

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

indenting

RPC_WALLET_NOT_SPECIFIED = -19, //!< No wallet specified (error when there are multiple wallets loaded)

// Referral engine errors
RPC_REFERRER_IS_SET = -100, //!< Wallet already has referal code and referrer set
Copy link
Member

Choose a reason for hiding this comment

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

why huge jump in num?

Copy link
Member

Choose a reason for hiding this comment

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

My intention was to start using 'blocks' of error codes like it is done in HTTP:
0xx - for wallet
1xx - for referral engine
It's a bit easier to find a free number or to find the error by number.

LOCK(mempool.cs);
auto map = &mempoolReferral.mapRTx;

for(auto it = map->begin(); it != map->end(); ++it ) {
Copy link
Member

Choose a reason for hiding this comment

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

for(const auto& p : map)
... p.second


bool SendReferralTx(CConnman *connman) {
ReferralRef referral = MakeReferralRef(MutableReferral());
ReferralTx rtx(referral);
Copy link
Member

Choose a reason for hiding this comment

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

indenting

adilwali pushed a commit that referenced this pull request Aug 25, 2017
c521b3ac6 Merge #11: fixup define checks. Cleans up some oopses from #5.
8b1cd3753 fixup define checks. Cleans up some oopses from #5.
6b1508d6d Merge #6: Fixes typo
fceb80542 Merge #10: Clean up compile-time warnings (gcc 7.1)
0ec2a343f Clean up compile-time warnings (gcc 7.1)
d4c268a35 Merge #5: Move helper functions out of sse4.2 object
8d4eb0847 Add HasAcceleratedCRC32C to port_win.h
77cfbfd25 crc32: move helper functions out of port_posix_sse.cc
4c1e9e016 silence compiler warnings about uninitialized variables
495316485 Merge #2: Prefer std::atomic over MemoryBarrier
2953978ef Fixes typo
f134284a1 Merge #1: Merge upstream LevelDB 1.20
ba8a445fd Prefer std::atomic over MemoryBarrier

git-subtree-dir: src/leveldb
git-subtree-split: c521b3ac654cfbe009c575eacf7e5a6e189bb5bb
@mempko mempko merged commit d3f6ca7 into master Aug 28, 2017
mempko added a commit that referenced this pull request Sep 28, 2017
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