File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,10 +33,48 @@ func handleConnection(conn net.Conn) {
3333 fmt .Println ("Client disconnected" )
3434 return
3535 }
36- // TODO Handle error (return OR continue)
36+ continue
37+ }
38+
39+ responseData := map [string ]any {}
40+
41+ requestedBlobsValue , hasRequestedBlobs := data ["requested_blobs" ]
42+ if hasRequestedBlobs {
43+ responseData ["available_blobs" ] = getAvailableBlobs (requestedBlobsValue .([]string ))
44+ }
45+
46+ blobDataPaymentRateValue , hasBlobDataPaymentRate := data ["blob_data_payment_rate" ]
47+ if hasBlobDataPaymentRate {
48+ responseData ["blob_data_payment_rate" ] = getBlobDataPaymentRate (blobDataPaymentRateValue .(float64 ))
49+ }
50+
51+ var incomingBlob map [string ]any
52+ var blobData []byte
53+
54+ requestedBlobValue , hasRequestedBlob := data ["requested_blob" ]
55+ if hasRequestedBlob {
56+ incomingBlob , blobData = getRequestedBlob (requestedBlobValue .(string ))
57+ responseData ["incoming_blob" ] = incomingBlob
3758 }
3859
39- fmt .Printf ("%+v\n " , data )
40- jsonEncoder .Encode (map [string ]any {})
60+ jsonEncoder .Encode (responseData )
61+ if blobData != nil {
62+ conn .Write (blobData )
63+ }
4164 }
4265}
66+
67+ func getAvailableBlobs (requestedBlobs []string ) []string {
68+ // TODO
69+ return []string {}
70+ }
71+
72+ func getBlobDataPaymentRate (blobDataPaymentRate float64 ) string {
73+ // TODO
74+ return "RATE_UNSET"
75+ }
76+
77+ func getRequestedBlob (requestedBlob string ) (map [string ]any , []byte ) {
78+ // TODO
79+ return map [string ]any {}, []byte {}
80+ }
Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ func handleConnection(conn net.Conn) {
3030 var data map [string ]any
3131
3232 err := jsonDecoder .Decode (& data )
33-
3433 if err != nil {
3534 if err == io .EOF {
3635 fmt .Println ("Client disconnected" )
You can’t perform that action at this time.
0 commit comments