From 9be2749e6d9e3869628096a5d7d29e61c95e338a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 16 Oct 2016 18:11:07 -0300 Subject: [PATCH] test --- iguana/dpow/dpow_network.c | 20 +++++++++++++------- iguana/dpow/dpow_tx.c | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index e3a655d18..ce3051404 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -165,25 +165,31 @@ 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,struct dpow_block *bp,int32_t src_or_dest) +int32_t dpow_rwopret(int32_t rwflag,uint8_t *opret,bits256 *hashmsg,int32_t *heightmsgp,char *src,struct dpow_block *bp,int32_t src_or_dest) { 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 ( src_or_dest == 0 ) { - opretlen += iguana_rwbignum(rwflag,&opret[opretlen],sizeof(*desttxid),desttxid->bytes); + opretlen += iguana_rwbignum(rwflag,&opret[opretlen],sizeof(&bp->desttxid),bp->desttxid.bytes); if ( rwflag != 0 ) { - for (i=0; src[i]!=0; i++) - opret[opretlen++] = src[i]; + if ( src != 0 ) + { + for (i=0; src[i]!=0; i++) + opret[opretlen++] = src[i]; + } opret[opretlen++] = 0; } else { - for (i=0; opret[opretlen]!=0; i++) - src[i] = opret[opretlen++]; - src[i] = 0; + if ( src != 0 ) + { + for (i=0; opret[opretlen]!=0; i++) + src[i] = opret[opretlen++]; + src[i] = 0; + } opretlen++; } } diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 88983c70b..7fca4486a 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -122,8 +122,8 @@ bits256 dpow_notarytx(char *signedtx,int32_t *numsigsp,int32_t isPoS,struct dpow satoshis = 0; len += iguana_rwnum(1,&serialized[len],sizeof(satoshis),&satoshis); if ( src_or_dest != 0 ) - opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,&bp->desttxid,src,bp,src_or_dest); - else opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,&bp->srctxid,src,bp,src_or_dest); + opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,0,bp,src_or_dest); + else opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,bp->srccoin->symbol,bp,src_or_dest); opretlen = dpow_opreturnscript(data,opret,opretlen); if ( opretlen < 0xfd ) serialized[len++] = opretlen;