File tree Expand file tree Collapse file tree 2 files changed +24
-5
lines changed
Expand file tree Collapse file tree 2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change 1717 inMsgQ chan wire.FtmInternalMsg
1818)
1919
20+ // TODO remove before production
21+ func TestCredit (key []byte , amt int32 ) {
22+ msg := wire .NewMsgTestCredit ()
23+ copy (msg .ECKey [:], key )
24+ msg .Amt = amt
25+
26+ inMsgQ <- msg
27+ }
28+
29+
2030func ChainHead (chainid string ) (* common.EBlock , error ) {
2131 h , err := atoh (chainid )
2232 if err != nil {
Original file line number Diff line number Diff line change @@ -49,8 +49,9 @@ func Start(db database.Db, inMsgQ chan wire.FtmInternalMsg) {
4949 server .Get ("/v1/chain-head/([^/]+)" , handleChainHead )
5050 server .Get ("/v1/entry-credit-balance/([^/]+)" , handleEntryCreditBalance )
5151
52- server .Get ("/v1/test/?" , handleTest )
53-
52+ // TODO remove before production
53+ server .Get ("/v1/test-credit/([^/]+)" , handleTestCredit )
54+
5455 wsLog .Info ("Starting server" )
5556 go server .Run ("localhost:" + strconv .Itoa (portNumber ))
5657}
@@ -59,9 +60,17 @@ func Stop() {
5960 server .Close ()
6061}
6162
62- func handleTest (ctx * web.Context ) {
63- wsLog .Info ("handleTest" )
64- ctx .WriteString ("hello" )
63+ // TODO remove before production
64+ func handleTestCredit (ctx * web.Context , eckey string ) {
65+ p , err := hex .DecodeString (eckey )
66+ if err != nil {
67+ wsLog .Error (err )
68+ ctx .WriteHeader (httpBad )
69+ return
70+ }
71+
72+ factomapi .TestCredit (p , 100 )
73+ ctx .WriteHeader (httpOK )
6574}
6675
6776func handleCommitChain (ctx * web.Context ) {
You can’t perform that action at this time.
0 commit comments