-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
630570d
commit 1fcf7de
Showing
21 changed files
with
1,341 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
currencyii/src/main/java/nl/tudelft/trustchain/currencyii/payload/AlivePayload.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package nl.tudelft.trustchain.currencyii.payload | ||
|
||
import nl.tudelft.ipv8.messaging.* | ||
|
||
class AlivePayload( | ||
val DAOid: ByteArray, | ||
) : Serializable { | ||
override fun serialize(): ByteArray { | ||
return DAOid | ||
} | ||
|
||
companion object Deserializer : Deserializable<AlivePayload> { | ||
override fun deserialize( | ||
buffer: ByteArray, | ||
offset: Int, | ||
): Pair<AlivePayload, Int> { | ||
// var localOffset = 0 | ||
// val payloadSize = deserializeUShort(buffer, offset) | ||
// localOffset += SERIALIZED_USHORT_SIZE | ||
// val publicKey = buffer.copyOfRange(offset + localOffset, offset + localOffset + payloadSize) | ||
// localOffset += payloadSize | ||
// return Pair(AlivePayload(publicKey), localOffset) | ||
var localOffset = 0 | ||
val (DAOid, DAOidLen) = deserializeRaw(buffer, offset + localOffset) | ||
localOffset += DAOidLen | ||
return Pair(AlivePayload(DAOid), localOffset) | ||
} | ||
} | ||
} |
Oops, something went wrong.