Skip to content

Commit

Permalink
Merge pull request #601 from wavesplatform/node-274-fix-generator-add…
Browse files Browse the repository at this point in the history
…ress-in-block-json

Corrected string representation of PublicKeyAccount
  • Loading branch information
alexeykiselev authored Oct 16, 2017
2 parents d35f716 + c619736 commit eb508c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/scala/scorex/account/PublicKeyAccount.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package scorex.account

import com.wavesplatform.state2.ByteStr
import scorex.crypto.encode.Base58
import scorex.transaction.ValidationError.InvalidAddress
import scorex.transaction.{TransactionParser, ValidationError}
Expand All @@ -15,7 +14,7 @@ trait PublicKeyAccount {

override def hashCode(): Int = publicKey.hashCode()

override lazy val toString: String = ByteStr.apply(this.publicKey).base58
override lazy val toString: String = this.toAddress.address
}

object PublicKeyAccount {
Expand Down
7 changes: 7 additions & 0 deletions src/test/scala/scorex/account/AccountSpecification.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ class AccountSpecification extends PropSpec with PropertyChecks with GeneratorDr
Address.fromString(addressVersion2).isRight shouldBe (AddressVersion2 == Address.AddressVersion)
}
}

property("PublicKeyAccount should return Address as it's string representation") {
forAll { bytes: Array[Byte] =>
val a = PublicKeyAccount.apply(bytes)
a.toString shouldBe a.toAddress.address
}
}
}

0 comments on commit eb508c2

Please sign in to comment.