jl777 8 years ago
parent
commit
a4e978c3b2
  1. 17
      iguana/dpow/dpow_network.c
  2. 2
      iguana/dpow/dpow_tx.c

17
iguana/dpow/dpow_network.c

@ -164,9 +164,9 @@ int32_t dpow_opreturnscript(uint8_t *script,uint8_t *opret,int32_t opretlen)
return(opretlen + offset);
}
int32_t dpow_rwopret(int32_t rwflag,uint8_t *opret,bits256 *hashmsg,int32_t *heightmsgp,bits256 *desttxid,char *src,bits256 *beaconp)
int32_t dpow_rwopret(int32_t rwflag,uint8_t *opret,bits256 *hashmsg,int32_t *heightmsgp,bits256 *desttxid,char *src,struct dpow_block *bp)
{
int32_t i,opretlen = 0;
int32_t i,opretlen = 0; bits256 beacon,beacons[DPOW_MAXRELAYS];
opretlen += iguana_rwbignum(rwflag,&opret[opretlen],sizeof(*hashmsg),hashmsg->bytes);
opretlen += iguana_rwnum(rwflag,&opret[opretlen],sizeof(*heightmsgp),(uint32_t *)heightmsgp);
if ( bits256_nonz(*desttxid) != 0 )
@ -185,7 +185,18 @@ int32_t dpow_rwopret(int32_t rwflag,uint8_t *opret,bits256 *hashmsg,int32_t *hei
src[i] = 0;
opretlen++;
}
} else opretlen += iguana_rwbignum(rwflag,&opret[opretlen],sizeof(*beaconp),beaconp->bytes);
}
else
{
memset(beacons,0,sizeof(beacons));
for (i=0; i<bp->numnotaries; i++)
{
if ( ((1LL << i) & bp->bestmask) != 0 )
beacons[i] = bp->notaries[i].beacon;
}
vcalc_sha256(0,beacon.bytes,beacons[0].bytes,sizeof(*beacons) * bp->numnotaries);
opretlen += iguana_rwbignum(rwflag,&opret[opretlen],sizeof(beacon),beacon.bytes);
}
return(opretlen);
}

2
iguana/dpow/dpow_tx.c

@ -121,7 +121,7 @@ bits256 dpow_notarytx(char *signedtx,int32_t *numsigsp,int32_t isPoS,struct dpow
serialized[len++] = CHECKSIG;
satoshis = 0;
len += iguana_rwnum(1,&serialized[len],sizeof(satoshis),&satoshis);
opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,&bp->desttxid,src,&bp->beacon);
opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,&bp->desttxid,src,bp);
opretlen = dpow_opreturnscript(data,opret,opretlen);
if ( opretlen < 0xfd )
serialized[len++] = opretlen;

Loading…
Cancel
Save