Skip to content

Commit

Permalink
Merge pull request #14 from 0rtis/v2-trigger-height
Browse files Browse the repository at this point in the history
Added debug makefile, some changes for v2 trigger height, minor changes to gitignore.
  • Loading branch information
mochimodev authored Nov 4, 2018
2 parents 36d8066 + 33d0ee3 commit ef3e4a1
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
/src/sortlt
/src/txclean
/src/wallet


#eclipse cpp
/src/.cproject
/src/.project
62 changes: 62 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion src/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
2 changes: 1 addition & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions src/wallet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ef3e4a1

Please sign in to comment.