Skip to content

Commit

Permalink
Merge pull request #51 from mochimodev/v23_testing
Browse files Browse the repository at this point in the history
Additional v2.3 Fixes Added
  • Loading branch information
mochimodev committed Apr 7, 2019
2 parents c3eaca0 + 02a1c19 commit 6b01768
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/bval.c
Expand Up @@ -294,7 +294,7 @@ int main(int argc, char **argv)

sha256_final(&mctx, mroot); /* compute Merkel Root */
if(memcmp(bt.mroot, mroot, HASHLEN) != 0)
drop("bad Merkle root");
baddrop("bad Merkle root");

sha256_update(&bctx, (byte *) &bt, sizeof(BTRAILER) - HASHLEN);
sha256_final(&bctx, bhash);
Expand Down
12 changes: 12 additions & 0 deletions src/gettx.c
Expand Up @@ -285,6 +285,18 @@ int gettx(NODE *np, SOCKET sd)
if(Trace) plog("gettx(): bad packet");
return 1; /* BAD packet */
}
/* Remove below code after v2.3 migration */
word32 tempv23a[2], tempv23b[2];
tempv23a[1] = 0;
tempv23b[1] = 0;
tempv23a[0] = V23TRIGGER - 1;
tempv23b[0] = V23TRIGGER + 55;
if(cmp64(Cblocknum, tempv23a) >= 0 && cmp64(Cblocknum, tempv23b) <= 55){
if(tx->version[0] != PVERSION) {
if(Trace) plog("gettx(): bad version");
return 1;
}
}
/*
Warning: This test breaks backward compatibility.
All code revisions should be backward compatible,
Expand Down
4 changes: 2 additions & 2 deletions src/util.c
Expand Up @@ -161,11 +161,11 @@ word32 remove32(word32 bad, word32 *list, unsigned maxlen, word32 *idx)
/* shuffle a list of < 64k word32's using Durstenfeld's algorithm */
void shuffle32(word32 *list, word32 len)
{
word32 *ptr, *p2, temp;
word32 *ptr, *p2, temp, listlen = len;

if(len < 2) return;
for(ptr = &list[len - 1]; len > 1; len--, ptr--) {
p2 = &list[rand16() % len];
p2 = &list[rand16() % listlen];
temp = *ptr;
*ptr = *p2;
*p2 = temp;
Expand Down

0 comments on commit 6b01768

Please sign in to comment.