diff --git a/.gitignore b/.gitignore index 3a9c469b..4487d411 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,8 @@ /src/sortlt /src/txclean /src/wallet + + +#eclipse cpp +/src/.cproject +/src/.project diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 00000000..37d313a1 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,62 @@ +############################################### +###### TO BE USED FOR DEBUG PURPOSE ONLY ###### +############################################### + +SHELL := /bin/bash +CC=gcc -DUNIXLIKE -DLONG64 -I/usr/lib -L/usr/local/cuda-9.2/lib64 +#CFLAGS=-W -Wall -ansi -pedantic -g +NVCC=nvcc -DLONG64 --generate-code arch="compute_37,code=\"sm_37,compute_37\"" +LDFLAGS=-lcudart -lcuda -lstdc++ +EXEC=mochimo bval bcon bup sortlt neogen txclean wallet +SOURCE_FOLDER=./ +BIN_FOLDER=../bin/ +OBJ_FOLDER=obj/Debug + +all: $(EXEC) +debug: $(EXEC) + +sha256.o: $(SOURCE_FOLDER)crypto/sha256.c + $(CC) -g -c $(SOURCE_FOLDER)crypto/sha256.c -o $(SOURCE_FOLDER)crypto/sha256.o $(LDFLAGS) + +wotshash.o: $(SOURCE_FOLDER)wots/wotshash.c + $(CC) -g -o $(SOURCE_FOLDER)crypto/wots/wotshash.o -c $(SOURCE_FOLDER)crypto/wots/wotshash.c $(LDFLAGS) + +wots.o: $(SOURCE_FOLDER)crypto/wots/wots.c + $(CC) -g -c $(SOURCE_FOLDER)crypto/wots/wots.c -o $(SOURCE_FOLDER)crypto/wots/wots.o $(LDFLAGS) + +cuda_trigg.o: + $(NVCC) -g -c $(SOURCE_FOLDER)trigg/cuda_trigg.cu -o $(SOURCE_FOLDER)trigg/cuda_trigg.o $(LDFLAGS) + +trigg.o: $(SOURCE_FOLDER)trigg/trigg.c + $(CC) -g -c $(SOURCE_FOLDER)trigg/trigg.c -o $(SOURCE_FOLDER)trigg/trigg.o $(LDFLAGS) + +mochimo: wots.o cuda_trigg.o trigg.o sha256.o + $(CC) -g -o $(BIN_FOLDER)mochimo $(SOURCE_FOLDER)mochimo.c $(SOURCE_FOLDER)trigg/trigg.o $(SOURCE_FOLDER)trigg/cuda_trigg.o $(SOURCE_FOLDER)crypto/wots/wots.o $(SOURCE_FOLDER)crypto/sha256.o $(LDFLAGS) + +wallet: wots.o sha256.o + $(CC) -g -o $(BIN_FOLDER)wallet $(SOURCE_FOLDER)wallet.c $(SOURCE_FOLDER)crypto/wots/wots.o $(SOURCE_FOLDER)crypto/sha256.o $(LDFLAGS) + +bval: wots.o trigg.o sha256.o + $(CC) -g -o $(BIN_FOLDER)bval $(SOURCE_FOLDER)bval.c $(SOURCE_FOLDER)trigg/trigg.o $(SOURCE_FOLDER)crypto/wots/wots.o $(SOURCE_FOLDER)crypto/sha256.o $(LDFLAGS) + +bcon: sha256.o + $(CC) -g -o $(BIN_FOLDER)bcon $(SOURCE_FOLDER)bcon.c $(SOURCE_FOLDER)crypto/sha256.o $(LDFLAGS) + +bup: sha256.o + $(CC) -g -o $(BIN_FOLDER)bup $(SOURCE_FOLDER)bup.c $(SOURCE_FOLDER)crypto/sha256.o $(LDFLAGS) + +sortlt: sha256.o + $(CC) -g -o $(BIN_FOLDER)sortlt $(SOURCE_FOLDER)sortlt.c $(SOURCE_FOLDER)crypto/sha256.o $(LDFLAGS) + +neogen: sha256.o + $(CC) -g -o $(BIN_FOLDER)neogen $(SOURCE_FOLDER)neogen.c $(SOURCE_FOLDER)crypto/sha256.o $(LDFLAGS) + +txclean: sha256.o + $(CC) -g -o $(BIN_FOLDER)txclean $(SOURCE_FOLDER)txclean.c $(SOURCE_FOLDER)crypto/sha256.o $(LDFLAGS) + + +clean: + rm -rf *.o + +mrproper: clean + rm -rf $(EXEC) diff --git a/src/tag.c b/src/tag.c index a47c5e9a..53476212 100644 --- a/src/tag.c +++ b/src/tag.c @@ -109,7 +109,7 @@ int tag_valid(byte *src_addr, byte *chg_addr, byte *dst_addr, int checkq, byte * unsigned long tagval_trigger = 0; if(checkq == 0 && bnum != NULL) { - tagval_trigger = 17185; /* For v2.0 */ + tagval_trigger = RTRIGGER31; /* For v2.0 */ } if(*((unsigned long *) bnum) >= tagval_trigger){ /* Ignore the below check prior to block 0x4000... diff --git a/src/util.c b/src/util.c index a64b334a..f2dee79e 100644 --- a/src/util.c +++ b/src/util.c @@ -531,7 +531,7 @@ void get_mreward(word32 *reward, word32 *bnum) static word32 delta3[2] = { 28488, 0 }; /* decrement */ if(cmp64(bnum, t1) < 0) { - /* bnum < 16383 */ + /* bnum < 17185 */ if(sub64(bnum, One, bnum2)) goto noreward; mult64(delta, bnum2, reward); add64(reward, base1, reward); diff --git a/src/wallet.c b/src/wallet.c index 93472713..b1b8a869 100644 --- a/src/wallet.c +++ b/src/wallet.c @@ -1243,6 +1243,17 @@ int get_tag(byte *addr, byte found[1]) found[0] = 0; return VERROR; } + + if(tx.send_total[0]) + { + /* check if the tag on resolved address is the one we asked */ + if(memcmp(ADDR_TAG_PTR(addr), ADDR_TAG_PTR(tx.dst_addr), ADDR_TAG_LEN) != 0) + { + found[0] = 0; + return VERROR; + } + } + memcpy(addr, tx.dst_addr, TXADDRLEN); found[0] = tx.send_total[0]; /* 1 if found, else 0 */ return VEOK;